Closed mo3ayka closed 2 months ago
Which version of YetAnotherHttpHandler and Unity is causing this problem?
@mayuki We checked that using latest 1.5.1 version of YetAnotherHttpHandler and Unity 2022.3.29f1
Thank you for the additional information. How are you passing CancellationToken
in grpcClientService.Settings_UpdateCameraPreviewModeAsync
?
Normally, CancellationToken
is not propagated from the client to the remote, so I'm curious about how it is handled.
I was able to reproduce a similar problem, so I will continue to investigate.
@mayuki Oops, sorry, we forgot to describe this aspect. Actually our grpcClientService
is a wrapper around the generated client.
Long story short, we just call the WithCancellationToken(cancellationToken)
method of the IService
interface under the hood.
We have released 1.5.2, which fixes the cancellation behavior in IL2CPP. Please try this version.
@mayuki You are great, a very quick fix! Thanks!
You rock @mayuki! ❤️
Hey @mayuki
We encountered another issue after updating YetAnotherHttpHandler. When canceling a token, an exception occurs on the client with different contents, depending on the environment
This is a client-side code:
And a server-side code:
The error we get when canceling the token on the client if we test through Unity Editor: unityEditorException.txt
The error we get when canceling the token on the client if we test the application on Android: androidException.txt
The main difference is that on Android, the
TaskCanceledExceptio
turns into anHttpRequestException
and we receive the status code notGrpc.Core.StatusCode.Cancelled
, butGrpc.Core.StatusCode.Internal
Is this behavior expected? Do we need to handle this behavior for Android additionally?Also, for the sake of the experiment, I tried to change the server code and throw the exception myself. In this case, both in Unity editor and on Android, we receive the status
Grpc.Core.StatusCode.Cancelled
:For easier testing on the client, I used a token with cancellation after 100 milliseconds: