You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Exponential workqueue backoff resets after 64 failures due to Java shift masking #4985
Java masks long shift distances to their low six bits. At exp == 64, both shifts behave as though the distance were zero, causing the delay to reset to the base instead of staying capped.
Upstream precedent: kubernetes/kubernetes#142641 describes a different arithmetic defect with the same important invariant: repeated failures must not defeat the configured maximum backoff. The Java defect is shift-distance wraparound, not the exact Go floating-point conversion defect.
Reproduction verified against Java source
Baseline: 9872badf5f69ee7d3bdb5fb7dc6183d2da935821.
Instantiate the limiter with Duration.ofMillis(5) and Duration.ofSeconds(1000) (the default controller's per-item settings). Call when("failing-object") 65 times without forget.
Observed:
Call 64: 1,000,000 milliseconds.
Call 65: 5 milliseconds.
Expected: after reaching the cap, subsequent calls remain at 1,000,000 milliseconds until the item is forgotten. This reproduction requires no sleeping or cluster.
Impact
Suggested priority: medium. Long-lived failures periodically restart fast retries, potentially producing retry bursts and excess API load during outages. Custom backoff configurations may expose additional overflow boundaries.
Acceptance criteria
Saturate at the maximum delay safely before unsafe shifting/multiplication; do not allow shift masking to restart backoff.
Preserve ordinary exponential behavior and forget/numRequeues semantics.
Add regression coverage across calls 63-66, 127-129, and a longer repeated sequence, checking every result rather than only the final call.
Cover default settings and large positive custom durations; preserve type safety and avoid arithmetic overflow.
Existing tests cover negative durations; assess compatibility explicitly rather than silently changing unrelated behavior.
Copilot instructions
Implement a focused fix with regression tests, run relevant tests, and open a PR referencing and closing this issue. Follow repository contribution conventions and the PR template. Do not bundle unrelated workqueue lifecycle or scheduling changes.
Activity
Fix exponential workqueue backoff saturation (closes #4985)
Fix exponential workqueue backoff saturation (closes #4985)