Repository navigation
Run retry and completion handling for transport failures - #1475
Merged
Merged
Conversation
Transport exceptions were remapped and rethrown directly from the send step, skipping modifyBeforeAttemptCompletion, readAfterAttempt, retry token refresh, modifyBeforeCompletion, and readAfterExecution. Route transport failures through the same attempt-completion path used for error responses so interceptors observe them and the retry strategy decides whether to retry.
ConnectTimeoutException is raised when a connection could not be established, so the request never reached the service. Its Javadoc already documents it as always retryable, but isRetrySafe() returned NO, so the standard retry strategy refused to retry it. Return YES.
adwsingh
approved these changes
Nov 30, 2026
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.
Problem
When
transport.sendthrew (connection refused, read timeout, reset, TLS failure, etc.),ClientPipelineremapped the exception and rethrew it directly. That skipped the rest of the attempt and execution lifecycle:modifyBeforeAttemptCompletion/readAfterAttemptRetryStrategy.refreshRetryToken, so the strategy was never consultedmodifyBeforeCompletion/readAfterExecution, so interceptors never observed the failureError responses already went through all of these; only transport failures bypassed them. A side effect is that
ConnectionAcquireTimeoutException, which already reportsRetrySafety.YES, could never actually be retried.Changes
deserialize()is extracted intocompleteAttempt(). A send failure builds anOutputHookwith no response or output and callscompleteAttempt(), so the completion hooks run, retry-info interceptors (e.g.ApplyModelRetryInfoPlugin) can classify the error, and the retry strategy decides whether to retry. Response-only hooks (readAfterTransmitthroughreadAfterDeserialization) are skipped since there is no response. Deserialize-path exception remapping is unchanged.ConnectTimeoutException(fromConnectExceptionorHttpConnectTimeoutException) means no connection was established, so the request never reached the service. Its Javadoc already said it is always retryable, butisRetrySafe()returnedNO. It now returnsYES.Other transport exceptions (read timeouts, resets, etc.) still report
NO; whether to retry those for idempotent operations is left for a follow-up.Testing
New
ClientPipelineTestcases (each fails without its corresponding change):TransportSocketTimeout, and the full hook sequence is asserted.ConnectTimeoutException.StandardRetryStrategyretries a connect failure on a non-idempotent operation.Ran
:client:client-core:checkand the tests forclient-http,dynamic-client,aws-client-core,aws-client-restjson, andretries.