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

SetRetryCount allows negative values that Backoff doesn't properly handle #404

Open
moorereason opened this issue Jan 11, 2021 · 3 comments

Comments

@moorereason
Copy link
Contributor

SetRetryCount allows values less than zero, but the Backoff implementation assumes opts.maxRetries is zero or greater. The result is that Backoff doesn't actually make a request but also doesn't return an error.

Two options for a solution:

  1. Convert negative values to zero in SetRetryCount.
  2. Convert a negative value into math.MaxInt64 (retry forever) in SetRetryCount.

In either case, Backoff should be updated to return an error if opts.maxRetries is less than zero.

Related to #392

@moorereason
Copy link
Contributor Author

@yjhmelody commented here that option 2 (retry forever) is preferred.

I tend to agree. Normally, a -1 in this scenario means "no limit."

@jeevatkm
Copy link
Member

@moorereason @yjhmelody Just wondering, the forever retry option is good or bad for the client library since it will result in DoS behavior on targeted application/service.

@jeevatkm jeevatkm added this to the v3.0.0 Milestone milestone Oct 1, 2023
@jeevatkm
Copy link
Member

jeevatkm commented Oct 1, 2023

Prevent -1 usage with error message

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

No branches or pull requests

2 participants