Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ON_ERROR_RETRY_EXPONENTIAL_BACKOFF overflows into 0s delay #618

Open
woho999 opened this issue Dec 21, 2024 · 1 comment
Open

ON_ERROR_RETRY_EXPONENTIAL_BACKOFF overflows into 0s delay #618

woho999 opened this issue Dec 21, 2024 · 1 comment
Assignees
Labels
bug Something isn't working p1

Comments

@woho999
Copy link

woho999 commented Dec 21, 2024

I've configured a hook with CONDITION_SNAPSHOT_START that pings for repo availability and has Error behaviour: ON_ERROR_RETRY_EXPONENTIAL_BACKOFF

Basically this works fine: when the hook fails for the first couple of times, retries occur with a backoff delay exponentially rising up to 1 hour, as expected.

However, after a certain amount of retries, the backoff delay suddenly drops to 0 seconds, causing constant retries.

I have no GO experince, but suppose this is caused by an overflow here:

d := time.Duration(math.Pow(2, float64(attempt-1))) * 10 * time.Second

Duration is a 64bit type if I googled correctly, so the argument won't fit after the 65th attempt. Should limit the attempt variable to stop growing when 1 hour is reached.

Btw, thanks for this nice piece of software, makes using restic almost a no-brainer :)

@garethgeorge
Copy link
Owner

garethgeorge commented Dec 21, 2024

Ouch, thanks for reporting this and appreciate the analysis. Your understanding of the bug seems right to me and makes it an easy fix -- fairly nasty bug. In the meantime I'd recommend using a fixed interval backoff e.g. 10 minutes. I'll get this patched in the next release.

Done in #619

@garethgeorge garethgeorge self-assigned this Dec 21, 2024
@garethgeorge garethgeorge added p1 bug Something isn't working labels Dec 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working p1
Projects
None yet
Development

No branches or pull requests

2 participants