Skip to content

fix(delay): clamp full-jitter ceiling to int64 range - #172

Merged
JaSei merged 2 commits into
mainfrom
fix/full-jitter-ceiling-overflow
Nov 4, 2026
Merged

JaSei merged 2 commits into
mainfrom
fix/full-jitter-ceiling-overflow

Conversation

@JaSei

@JaSei JaSei commented Nov 4, 2026

Copy link
Copy Markdown
Collaborator

FullJitterBackoffDelay panics with "invalid argument to Int63n" once the
exponential ceiling exceeds math.MaxInt64 (attempt 34 with Delay(1s) and no
MaxDelay). Converting an out-of-range float64 to int64 is implementation-
defined in Go; on amd64 it yields a negative value that Int63n rejects.
arm64 saturates, so the bug is invisible there.

Saturate the ceiling at math.MaxInt64 before the conversion.

Builds on the approach from #159.

Co-authored-by: dualfroz <me@dualfroz.com>
@codecov

codecov Bot commented Nov 4, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.51%. Comparing base (443bc80) to head (3d0fc0e).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #172      +/-   ##
==========================================
+ Coverage   97.47%   97.51%   +0.03%     
==========================================
  Files           4        4              
  Lines         238      241       +3     
==========================================
+ Hits          232      235       +3     
  Misses          6        6              
Flag Coverage Δ
unittest 97.51% <100.00%> (+0.03%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@JaSei
JaSei merged commit 842bf05 into main Nov 4, 2026
43 of 44 checks passed
@JaSei
JaSei deleted the fix/full-jitter-ceiling-overflow branch November 4, 2026 15:51
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.

1 participant