GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — fix: first attempt should use the min of RPC timeout and total timeout by mutianf · Pull Request #2641 · googleapis/sdk-platform-java
This repository was archived by the owner on Oct 29, 2026. It is now read-only.
Conversation
|
|
drive-by comment - I think this change intuitively makes sense, but we should make sure we document it properly as RetrySettings have caused a lot of confusion in the past. @lqiu96 has been working on a guide here: googleapis/google-cloud-java#10598 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Thanks @mutianf. Can you create an issue to describe the issue that you and BigTable are facing so that we can have a bit more context? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| totalTimeout == 0 | ||
| ? globalSettings.getInitialRpcTimeout() |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I believe this check is needed because it's possible that totalTimeout is not set (or set to 0) and it's being limited by number of attempts? If that's correct, could you add a small comment above to detail this?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Done! Also created a issue #2643
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
qq, do you know if there is a valid use case where the total timeout is non-zero (explicitly set by the user), but the the total timeout is set to be less than the initialRPCTimeout? The only thing that I can think of right now is that a user has both time and attempt bounds and they care more about the attempt bounds (maybe?). Even if that is the case, the initialRPCTimeout shouldn't be larger than the totalTimeout.
After some more thought, I'm slightly leaning towards having a check that ensures that the initialRPCTimeout is less than or equal to the total timeout if totalTimeout is set. It should eliminate the need for a check here. Something here:
sdk-platform-java/gax-java/gax/src/main/java/com/google/api/gax/retrying/RetrySettings.java
Lines 429 to 452 in e542af8
| if (params.getTotalTimeout().toMillis() < 0) { | |
| throw new IllegalStateException("total timeout must not be negative"); | |
| } | |
| if (params.getInitialRetryDelay().toMillis() < 0) { | |
| throw new IllegalStateException("initial retry delay must not be negative"); | |
| } | |
| if (params.getRetryDelayMultiplier() < 1.0) { | |
| throw new IllegalStateException("retry delay multiplier must be at least 1"); | |
| } | |
| if (params.getMaxRetryDelay().compareTo(params.getInitialRetryDelay()) < 0) { | |
| throw new IllegalStateException("max retry delay must not be shorter than initial delay"); | |
| } | |
| if (params.getMaxAttempts() < 0) { | |
| throw new IllegalStateException("max attempts must be non-negative"); | |
| } | |
| if (params.getInitialRpcTimeout().toMillis() < 0) { | |
| throw new IllegalStateException("initial rpc timeout must not be negative"); | |
| } | |
| if (params.getMaxRpcTimeout().compareTo(params.getInitialRpcTimeout()) < 0) { | |
| throw new IllegalStateException("max rpc timeout must not be shorter than initial timeout"); | |
| } | |
| if (params.getRpcTimeoutMultiplier() < 1.0) { | |
| throw new IllegalStateException("rpc timeout multiplier must be at least 1"); | |
| } |
CC: @blakeli0
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Yeah, we have a customer that only sets total timeout to be 400ms. The default initialRpcTimeout in bigtable client is 20 seconds. I think adding the check here would cause the breakage for the customer.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Gotcha, I'm guessing they also either override the initialRpcTimeout or they're fine that call only runs a max of 400ms. I don't know the full context and there may be a use case where intialRpcTimeout > totalTimeout. Either way, I think you're right and we can't make that change. I think this solution is fine with me then.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
/gcbrun |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
/gcbrun |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
This fix makes sense but is also technically a change of behavior. If a customer has initialRpcTimeout set larger than totalTimeout, and has been incorrectly relying on this behavior, then they would have to change their code.
That being said, I think we should fix it but we should add some Javadoc to RetrySetting in relevant sections for totalTimeout and initialRpcTimeout. In case someone complains(hopefully not), we can at least point them to the relevant docs.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
I think having |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
/gcbrun |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
/gcbrun |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
ExponentialRetryAlgorithm should use the min of initialRpc and total timeout on the first attempt
There was an error while loading. Please reload this page.