Skip to content

cap retry delays without float overflow - #1402

Merged
bgentry merged 1 commit into
masterfrom
bg/cap-retry-delays
Sep 28, 2026
Merged

bgentry merged 1 commit into
masterfrom
bg/cap-retry-delays

Conversation

@bgentry

@bgentry bgentry commented Sep 28, 2026

Copy link
Copy Markdown
Contributor

From the 310th error onward, the default retry policy caps its delay at the maximum time.Duration. Converting that cap through float seconds can produce the minimum int64 on amd64, scheduling retries roughly 292 years in the past and causing jobs with many allowed attempts to run again immediately.

Return the maximum duration directly at the cap. The cap test now expects that exact duration, and the changelog records the fix.

@bgentry
bgentry force-pushed the bg/cap-retry-delays branch from d303827 to 744a6e1 Compare September 28, 2026 02:16
From the 310th error on, the default retry policy caps its delay at the
maximum `time.Duration`, but it converts the capped value from float
seconds with `timeutil.SecondsAsDuration`. That float is 2^63
nanoseconds, one past the largest `int64`, and Go leaves out-of-range
float-to-integer conversions implementation-specific: arm64 saturates,
while amd64 produces the minimum `int64`, scheduling the retry about 292
years in the past so the job runs again immediately.

Return the maximum duration directly whenever the seconds reach the
cap, and make the existing cap test expect the exact maximum instead of
recomputing it with the same overflowing conversion.
@bgentry bgentry changed the title [Draft] cap retry delays without float overflow Cap retry delays to avoid float overflow Sep 28, 2026
@bgentry
bgentry force-pushed the bg/cap-retry-delays branch from 744a6e1 to 70c50ee Compare September 28, 2026 15:26
@bgentry bgentry changed the title Cap retry delays to avoid float overflow cap retry delays without float overflow Sep 28, 2026
@bgentry
bgentry marked this pull request as ready for review September 28, 2026 15:26
@bgentry
bgentry enabled auto-merge (squash) September 28, 2026 15:27
@bgentry
bgentry merged commit 920f14a into master Sep 28, 2026
15 checks passed
@bgentry
bgentry deleted the bg/cap-retry-delays branch September 28, 2026 15:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants