This repository has been archived by the owner on Sep 26, 2023. It is now read-only.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
fix: truncate RPC timeouts to time remaining in totalTimeout #1191
fix: truncate RPC timeouts to time remaining in totalTimeout #1191
Changes from 1 commit
42a113f
9aea1ba
10f9f84
cb8a7d5
dcbf828
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What would happen if
newRpcTimeout <= 0
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If
newRpcTimeout <= 0
, the subsequent check byshouldRetry
would prevent another attempt from being made, because they do a similar check to see if the current time + the proposed random delay would exceed thetotalTimeout
:We could add some logic to handle
if (timeLeft.isNegative() || timeLeft.isZero())
, but I'm not sure what we'd set it to...maybe allownewRpcTimeout
to remain unchanged bytimeLeft
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After our offline conversation, I've decided to just document the likely behavior. LMK if you feel strongly otherwise.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the meaning of totalTimeout in case of LRO? Note that exponential retry algorithm is shared between retries and LRO polling logic. Whatever we do for retries, we must ensure that it does not break LRO. Ideally we want that new logic be completelly disabled fro LRO. I.e. the need to modify LRO tests indicates that there is a breaking behavioral change for LRO, which we should avoid.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had the same thought and I was confused by what this test was doing.
The test setup actually sets by default a
totalTimeout
to be5 ms
, but then in this test increases theinitialRpcTimeout
andmaxRpcTimeout
to values much greater than the existingtotalTimeout
of5ms
. Per comments in a generated client, theinitialRpcTimeout
andmaxRpcTimeout
should be ignored and set to 0 for LROs? Not really sure what the test is doing here.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FWIW we had no GAPIC config for LRO polling
initialRpcTimeout
ormaxRpcTimeout
, so they would never be generated and only ever set by users...and they'd have the same behavior as non-LRO RPCs where a poll could run over thetotalTimeout
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess this test was testing for the existing incorrect behavior, where the RPC timeout didn't care if it exceeded the
totalTimeout
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
totalTimeout
in the context of LRO is the "total polling timeout" (gapic config). So, the duration a "synchronous" LRO call should poll before giving up.This test was set up weirdly, as I described. PTAL.