-
Notifications
You must be signed in to change notification settings - Fork 504
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
TaskCanceledException thrown from ReadItemStreamAsync #1589
Comments
I've now also seen an
|
All these exceptions point at connectivity issues, looking at the stack they are all coming from the
The OperationCanceledException has the same source (a timeout). Do you have a singleton CosmosClient in your application? Or multiple instances? Are you by any chance running into some of the scenarios described in: https://docs.microsoft.com/en-us/azure/cosmos-db/troubleshoot-dot-net-sdk#request-timeouts |
The timeouts were being caused by a hot partition. However, the bug I was reporting wasn't that these errors occurred, but that when they did occur, the they weren't trapped in the SDK code and transformed into a response with the error details on it. |
I think that for these types (OperationCanceledException and TaskCanceledException) we are not wrapping it on a CosmosException on purpose, right @j82w?. There was even an ask in a previous issue about it. |
This seems like a bug and we should be converting this to a 408 request timeout. The gateway store already does this. I think it provides a more consistent and better user experience if it gets converted. |
Closing as TaskCanceledExceptions as the SDK now wraps them with a request timeout
|
Describe the bug
When invoking
ReadItemStreamAsync
without passing a cancellation token, it returned an task cancelled exception. I assume a transient issue occurred to cause the error.However, the bug I am reporting is that it threw the exception, rather returning a response that we can examine for the cause of the error or invoke
ThrowExceptionIfUnsucessful
on.It may or may not have also bypassed the built-in retry logic for errors.
To Reproduce
This is intermittent and has only happened to us once in millions of executions of the same query pattern. This issue isn't that it fails, but it throws an unexpected exception type.
Expected behavior
A failed call to
ReadItemStreamAsync
should return a response with error information that can be turned into aCosmosException
by callingThrowExceptionIfUnsuccessful()
when its internal tasks are cancelled.Actual behavior
A call to
ReadItemStreamAsync
can sometimes throw aTaskCancelledException
even though no cancellation token was passed in.Environment summary
SDK Version: 3.8
OS Version: Azure Functions V3 host
We have updated our SDK to 3.9 but this is a rare issue and haven't reproduced it there.
Additional context
Our application logging captured a partial stack trace. It deletes lines that are just async continuation information.
The text was updated successfully, but these errors were encountered: