Repository navigation
fix(storage): preserve HTTP status for XML multipart upload errors so retries work - #14804
Merged
Merged
Conversation
… retries work MultipartUploadClientImpl sends raw XML API requests that throw a plain HttpResponseException on error. These were not translated, so the retrier's catch-all coalesced them into a StorageException with code 0, and the retry strategy could not classify them. As a result, retryable responses (408, 429, 5xx) were never retried, even for idempotent operations such as uploadPart, and callers saw getCode() == 0. Translate IOExceptions via StorageException.translate inside each MultipartUploadClient operation, matching HttpStorageRpc, so the HTTP status code is preserved and retries follow the standard rules. createMultipartUpload remains non-idempotent and is not retried.
Contributor
There was a problem hiding this comment.
Code Review
This pull request updates MultipartUploadClientImpl to translate IOExceptions into StorageExceptions before they reach the retrier, ensuring that HTTP status codes are preserved and transient errors can be properly classified and retried. It also introduces a comprehensive integration test suite in ITMultipartUploadClientRetryTest.java to verify this retry behavior. Feedback on the tests suggests optimizing uploadPart_retriesAllRetryableStatusCodes by instantiating the FakeHttpServer once outside the loop to avoid the overhead of repeatedly starting and stopping the server.
ShreyasSinha
approved these changes
Oct 28, 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.
Summary
MultipartUploadClient(XML multipart upload API) never retried retryable HTTP responses such as503 Service Unavailable, even for idempotent operations likeuploadPart, despite defaultRetrySettings(maxAttempts: 6).Root cause
MultipartUploadHttpRequestManagerexecutes rawHttpRequests withsetThrowExceptionOnExecuteError(true), so an error response surfaces as a plainHttpResponseException. UnlikeHttpStorageRpc,MultipartUploadClientImpldid not translate thatIOException, so it reached the catch-all inRetrying.DefaultRetrier, which callsStorageException.coalesce(e).coalesceis a generic fallback and (as documented) creates aStorageExceptionwithUNKNOWN_CODE(0). With code 0,DefaultStorageRetryStrategycannot classify the error and returnsNO_RETRY.Fix
Wrap each
MultipartUploadClientImploperation so anyIOExceptionis converted viaStorageException.translate(...)before reaching the retrier.