Fix nested retry loops for transient network errors#17267
Closed
shayonj wants to merge 1 commit intoastral-sh:mainfrom
Closed
Fix nested retry loops for transient network errors#17267shayonj wants to merge 1 commit intoastral-sh:mainfrom
shayonj wants to merge 1 commit intoastral-sh:mainfrom
Conversation
zanieb
reviewed
Dec 30, 2025
Comment on lines
+1148
to
+1149
| /// Kept for API compatibility with callers that pass `retry_policy`. | ||
| _retry_policy: ExponentialBackoff, |
Member
There was a problem hiding this comment.
It's fine to break API compatibility here, every release is considered breaking at this time.
Author
|
looks like there is a fix proposed in #17274. Closing on behalf |
Contributor
|
@shayonj ah, my apologies, I had missed that you were already working on a fix. |
Author
|
no probs at all! thank you for the fast fix |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes a regression where transient network errors (like DNS failures) cause nested retry loops,
resulting in ~16 retry attempts instead of 4 and significantly longer failure times (~17-19s vs ~4s).
Problem
After #17104, both the middleware (
RetryTransientMiddleware) and the cached client layer(
RetryState::should_retry) independently retry transient network errors. When the middlewareexhausts its retry budget and returns an error,
should_retrystarts a fresh retry loop,causing nested retries.
Fix
RetryState::should_retrynow only tracks middleware retries for error reporting instead ofinitiating additional retries for transient errors. The middleware already handles transient
retry logic, so duplicating it here causes the nested loops.
Test Plan