-
Notifications
You must be signed in to change notification settings - Fork 494
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
Initialization: Fixes the SDK to retry if the initialization fails #3027
Conversation
Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/CosmosClientTests.cs
Outdated
Show resolved
Hide resolved
Thanks for addressing this issue. I have found that this can also cause problems for psuedo-transient errors like permissions. E.g., if you construct a CosmosClient before setting SQL RBAC permissions for the identity accessing CosmosDB, the failed authorization exception can be returned to clients until a fresh CosmosClient object is created. These manifest as persistent exceptions that contain something like:
|
Pull Request Template
Description
The SDK has an initialization task to get the account information and other info. If this task fails with a
DocumentClientException
it was never being recreated. This is a problem because if a 408 is thrown or some other transient problem the SDK will always returned the cached failure and will not actually retry the request.Solution:
A new initialization function factory was created. This allows the initialization task to be recreated. The EnsureValidClientAsync now calls a new method that is thread safe to get or create a new task if the existing one failed.
Type of change
Please delete options that are not relevant.
Closing issues
To automatically close an issue: closes #2990