-
Notifications
You must be signed in to change notification settings - Fork 107
Fix LRO callables so that the ApiCallContext is always passed through. #600
Fix LRO callables so that the ApiCallContext is always passed through. #600
Conversation
Codecov Report
@@ Coverage Diff @@
## master #600 +/- ##
============================================
- Coverage 75.02% 75.02% -0.01%
+ Complexity 934 931 -3
============================================
Files 176 176
Lines 4076 3607 -469
Branches 323 297 -26
============================================
- Hits 3058 2706 -352
+ Misses 865 750 -115
+ Partials 153 151 -2
Continue to review full report at Codecov.
|
@vam-google Are you ok with the behavioral change? If not, I can add code that explicitly disables rpc timeouts for LRO polling, but I think that not having RPC timeouts for LRO polling is a bug |
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.
LGTM
externalFuture.setAttemptFuture(new NonCancellableFuture<ResponseT>()); | ||
if (externalFuture.isDone()) { | ||
return null; | ||
} | ||
ApiFuture<ResponseT> internalFuture = callable.futureCall(null, null); | ||
// NOTE: The callable here is an OperationCheckingCallable, which will compose its own |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
*/ | ||
@Override | ||
public ApiFuture<OperationSnapshot> futureCall(RequestT request, ApiCallContext context) { | ||
public ApiFuture<OperationSnapshot> futureCall(RequestT ignored, ApiCallContext callContext) { |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
@@ -59,11 +59,11 @@ | |||
/** | |||
* This method is supposed to be called from {@link AttemptCallable#call()} | |||
* | |||
* @param request request | |||
* @param context call context | |||
* @param ignored request. The request will be composed based on the result of the initialFuture. |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
@igorbernstein2 please check the fix for the In general, it seems we, during retries implementation, paid all the attention to the retries from the point of view of client (i.e. the actual operaiton retries and timeouts), but did not pay enough attention to the rpcTimeout value (all the bugs found are about the rpcTimeout stuff). For example, the existing tests for retries and retrying executor do not even validate the value of rpcTimeout in any way. Additional action item should be to add the tests... But it is out of scope of this PR. |
@vam-google I think your commit should be done separately from this PR. The change doesn't fully address the problem. The outstanding issue now is that the initial
The first rpcTimeout will be skipped. However, if the initialFuture completes before step 5, then the initial rpcTimeout will be used. Fixing this properly is a fairly deep rabbit hole that I don't want to block my work on opencensus. The actual impact of this issue is almost nonexistent because almost all usecases will use a constant rpcTimeout. |
@igorbernstein2 The described behavior is by design. A clarification, this paragraph can be skipped { The The normal callables are implementation detail, which define how that asynchronous behavior is shoved into JDK's concurrency model. Not each call to The behavior you described affects not only rpcTimeout but also the retryDelay (poll delay in this context), and it was by design as well. The meaning of In general, you are right, About the bug |
This is the next step in integrating OpenCensus (#583). My plans for OpenCensus involve passing a wrapped span through
ApiCallContext
. Unfortunately as it stands, LRO callables don't respect ApiCallContext and drop it. This PR aims to fix the situation by always passing the ApiCallContext and removing null checks along the way.Please note that this is a behavioral change: LRO polling attempts will now use the RPC in the
RetrySettings
thatOperationTimedPollAlgorithm
was instantiated with.