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

OperationCanceledException thrown when canceling a CancelationToken does not reference the token canceled when using Retries #2304

Closed
Watno opened this issue Oct 20, 2023 · 0 comments · Fixed by #2345
Labels
bug Something isn't working

Comments

@Watno
Copy link

Watno commented Oct 20, 2023

What version of gRPC and what language are you using?

Grpc.Net.Client 2.58.0, C#

What operating system (Linux, Windows,...) and version?

Windows 11

What runtime / compiler are you using (e.g. .NET Core SDK version dotnet --info)

SDK 7.0.402

What did you do?

The situation is similar to #2014: OperationCanceledException thrown when canceling a CancelationToken does not reference the token canceled
When having Retries enabled in the GrpcClient, (i.e. when specifying a RetryPolicy with MaxRetryAttemps > 0 in the ClientConfiguration), the client is called and then the CancelationToken passed is cancelled before the gRPC call completes.

What did you expect to see?

An OperationCanceledException with the CancelationToken passed.

What did you see instead?

An OperationCanceledException with a different CancelationToken than the one passed.
Stacktrace of the exception:

 ---> System.OperationCanceledException: The operation was canceled.
   at System.Threading.CancellationToken.ThrowOperationCanceledException()
   at Grpc.Net.Client.Internal.Retry.RetryCall`2.StartRetry(Action`1 startCallFunc)
   --- End of inner exception stack trace ---
   at Grpc.Net.Client.Internal.Retry.RetryCallBase`2.GetResponseCoreAsync()```
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.

1 participant