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

Wrong bootstrapping when retrying #675

Closed
pat-karakun opened this issue Sep 7, 2021 · 2 comments · Fixed by #678
Closed

Wrong bootstrapping when retrying #675

pat-karakun opened this issue Sep 7, 2021 · 2 comments · Fixed by #678
Assignees
Labels
bug Something isn't working
Milestone

Comments

@pat-karakun
Copy link

It seems to me that there is an off by 1 error when bootstrapping the retry mechanism (see for example here ) .
By calling AtomicInteger#incrementAndGet() instead of #getAndIncrement() the int iteration starts with 1 instead of 0 which has (at least) these two consequences (ignoring jitter):

  1. there are not numRetries attempts to retry but only numRetries - 1
  2. the first retry attempt is done after 2*firstBackoff (= firstBackoff * 2^1) instead of after firstBackoff (= firstBackoff * 2^0)

The two effects almost compensate each other wrt when the last attempt is roughly performed, so it's certainly not an issue for most cases.

@cescoffier
Copy link
Contributor

Thanks and very nice catch! I just opened a PR fixing the issue.

@cescoffier cescoffier added the bug Something isn't working label Sep 9, 2021
@jponge
Copy link
Member

jponge commented Sep 9, 2021

Thanks @pat-karakun

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants