Azure / Azure/azure-sdk-for-java

[BUG] Azure Cosmos DB GlobalEndpointManager should not retry on 401 and 403

Open
#21,935 5 comments 0 reactions 1 assignee Assigned to @mbhaskar View on GitHub
bug Client Cosmos cosmos-java-ecosystem-se-planning cosmos:v4-item
Dominant language
Java
Stars
2.6k
Forks
2.2k
Avg merge
2d 8h
Merged PRs (30d)
178

Description

**Describe the bug**
The current GlobalEndpointManager will retry on the secondary regions for all failures. In the case a unauthorized or forbidden exception it should just return the exception instead of trying secondary regions.

https://github.com/Azure/azure-sdk-for-java/blob/958a0a774d99681613db83dbe7337fab1cfdd009/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/GlobalEndpointManager.java#L96

***Exception or Stack Trace***
Add the exception log and stack trace if available

**To Reproduce**
1. Create a Cosmos DB SDK instance with a invalid key or an AAD admin with invalid permissions with multiple preferred regions configured.
2. Try to do any operation. The SDK will attempt the request on all the regions instead of just failing after the first one.

**Expected behavior**
The Cosmos DB SDK should not retry on secondary regions if a non-retriable exception is hit.

The .NET fix: https://github.com/Azure/azure-cosmos-dotnet-v3/pull/2511

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.