diff --git a/Microsoft.Azure.Cosmos/src/HttpClient/HttpTimeoutPolicyControlPlaneRetriableHotPath.cs b/Microsoft.Azure.Cosmos/src/HttpClient/HttpTimeoutPolicyControlPlaneRetriableHotPath.cs index 8143b49015..ad4dbeb8d0 100644 --- a/Microsoft.Azure.Cosmos/src/HttpClient/HttpTimeoutPolicyControlPlaneRetriableHotPath.cs +++ b/Microsoft.Azure.Cosmos/src/HttpClient/HttpTimeoutPolicyControlPlaneRetriableHotPath.cs @@ -20,9 +20,14 @@ private HttpTimeoutPolicyControlPlaneRetriableHotPath(bool shouldThrow503OnTimeo this.shouldThrow503OnTimeout = shouldThrow503OnTimeout; } + // The first-attempt timeout was raised from 500ms to 1s to align with HttpTimeoutPolicyForThinClient + // (see issue #5642). The original 500ms value caused spurious TaskCanceledException retries on + // .NET 10 due to changes in HttpConnectionPool behavior and any environment with moderate network + // latency. The 5s and 65s tail attempts are preserved to keep the existing retry budget for slow + // control-plane operations. private readonly IReadOnlyList<(TimeSpan requestTimeout, TimeSpan delayForNextRequest)> TimeoutsAndDelays = new List<(TimeSpan requestTimeout, TimeSpan delayForNextRequest)>() { - (TimeSpan.FromSeconds(.5), TimeSpan.Zero), + (TimeSpan.FromSeconds(1), TimeSpan.Zero), (TimeSpan.FromSeconds(5), TimeSpan.FromSeconds(1)), (TimeSpan.FromSeconds(65), TimeSpan.Zero), }; diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/CosmosHttpClientCoreTests.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/CosmosHttpClientCoreTests.cs index 187df15b9c..c411ef70e0 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/CosmosHttpClientCoreTests.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/CosmosHttpClientCoreTests.cs @@ -75,7 +75,7 @@ public async Task RetryTransientIssuesTestAsync() }}, {HttpTimeoutPolicyControlPlaneRetriableHotPath.Instance, new List() { - TimeSpan.FromSeconds(1), + TimeSpan.FromSeconds(2), TimeSpan.FromSeconds(6), TimeSpan.FromSeconds(66) }},