Repository navigation
improve multipart part retries with exponential backoff & preserve root errors - #44
Merged
Merged
Conversation
… upload errors - Fix abort state in NetworkFacade to preserve and propagate actual abort errors instead of masking them as UploadNotSuccessful. - Implement exponential backoff with jitter and selective error filtering (isRetryableChunkError) in UploadPartOperation. - Pass HTTP status code in PartUploadFailed for non-200 S3 responses in UploadMultipart. - Conform UploadError to LocalizedError for clean string descriptions.
sg-gs
reviewed
Jul 22, 2026
sg-gs
approved these changes
Jul 22, 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
Fixes an issue where multipart upload failures were masked as
UploadNotSuccessfuldue to unhandled abort states inNetworkFacade.Previously, part-level retries were only triggered during offline states (
notConnectedToInternet/networkConnectionLost), while transient network issues like S3 request timeouts (-1001), server errors (5xx), or rate limits (429) failed immediately without retrying.This PR improves part-level resilience by introducing Exponential Backoff with Jitter, selective error classification for transient failures, preserving underlying root-cause errors, conforming
UploadErrortoLocalizedError.🛠️ Changes Introduced
Smart Part-Level Retry & Error Classification:
notConnectedToInternet/networkConnectionLost) and retried immediately without delay.isRetryableChunkErrorto retry transient network conditions (timeouts-1001, host unreachable-1003/-1004, HTTP5xx, HTTP429, HTTP status-1) while immediately aborting non-retryable errors (e.g. HTTP4xx).Exponential Backoff & Jitter:
pow(2.0, attempt)) with random jitter inUploadPartOperation.uploadPartWithRetry()to prevent request storms against S3 endpoints during transient hiccups.Error Preservation & Propagation:
uploadState.setAborted(error: partError)andencryptFileIntoChunksinNetworkFacade.swiftto preserve and propagate the actualPartUploadFailederror instead of falling back to genericUploadError.UploadNotSuccessful.HTTP Status Code Exposure & Localized Errors:
UploadMultipart.swiftto return non-200 S3 responses wrapped inPartUploadFailedcontaining the actual HTTP status code.UploadErrortoLocalizedErrorfor descriptive string representations in system logs (PartUploadFailed(partIndex: X, error: Y)).