Skip to content

pkg/retry: don't panic when the retry delay is too small for jitter - #1072

Open
ROKUMATE wants to merge 1 commit into
podman-container-tools:mainfrom
ROKUMATE:retry-no-panic-on-small-delay
Open

pkg/retry: don't panic when the retry delay is too small for jitter#1072
ROKUMATE wants to merge 1 commit into
podman-container-tools:mainfrom
ROKUMATE:retry-no-panic-on-small-delay

Conversation

@ROKUMATE

Copy link
Copy Markdown

Fixes: #1071

rand.N panics on a non-positive argument and delay / 10 is 0 below 10ns, so any
Options.Delay under that panicked IfNecessary. Negative delays too.

Only jitter when there's a positive range to jitter over. No change at 10ns and above.

Reachable from containers.conf: [engine] retry_delay is parsed with
time.ParseDuration and reaches Options.Delay through libimage with no range check.

The package had no tests, so this adds coverage for the delay handling:
1ns/5ns/9ns/10ns/negative, plus the default exponential path. Reverting the fix makes
them panic at retry.go:51.

@github-actions github-actions Bot added the common Related to "common" package label Aug 12, 2026
Comment thread common/pkg/retry/retry.go
Comment thread common/pkg/retry/retry_test.go Outdated
Comment thread common/pkg/retry/retry_test.go Outdated
@ROKUMATE
ROKUMATE force-pushed the retry-no-panic-on-small-delay branch from d0a4370 to 1be57f9 Compare August 12, 2026 20:34
@ROKUMATE

Copy link
Copy Markdown
Author

i have addressed all the reviews in the next commit ... do tell if any more changes are required

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

common Related to "common" package

Projects

None yet

Development

Successfully merging this pull request may close these issues.

pkg/retry: IfNecessary panics when the retry delay is under 10ns

3 participants