You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
allow fresh computation of flex checksum on retry #3380
I have verified all of my SDK modules are up-to-date (you can perform a bulk update with go get -u github.com/aws/aws-sdk-go-v2/...)
Describe the bug
When we use transferManager.UploadObject to upload a file under high write contention (being written to as it's being uploaded), and the upload is retried, we get a BadDigest / checksum mismatch error: operation error S3: PutObject, https response error StatusCode: 400, RequestID: , HostID: , api error BadDigest: The X-Amz-Checksum-Crc32 you specified did not match what we received.
It looks like the checksum is being cached and reused on retry.
Regression Issue
Select this option if this issue appears to be a regression.
Expected Behavior
I expect the checksum to be computed again on retry.
Current Behavior
I think the checksum is being cached and reused on retry.
I let Copilot dig into it, and it identified code in middleware_compute_input_checksum.go, where the checksum looks like it is cached to m.checksum and then reused on retry.
Reproduction Steps
In our code, we pass a read-only file handle as an io.Reader into transferManager.UploadObject.
This is done in parallel with other handles which write to the file during upload.
This issue only occurs when the upload is retried. Unfortunately, I don't know how to make that retry happen for testing or issue reproduction.
Possible Solution
Compute a fresh checksum every time the stream is rewound for a new attempt.
If this is a performance issue, maybe a flag could be added to UploadObjectInput to direct the SDK to compute fresh checksums on every attempt, for cases like this, where the stream source can be written to in parallel.
Additional Information/Context
I'm not thrilled with the fact that we're uploading a file in high write contention, but our code prioritizes fast writes over this concern. And waiting for write contention to die down before uploading might not always be possible.
changed the title [-]Checksum Error on Retry With io.Reader Under Write Contention[/-][+]allow fresh computation of flex checksum on retry[/+]on Apr 14, 2026
I took a look at the issue and the related checksum middleware logic. Since the current behavior is intentional for performance reasons, would maintainers be open to a configurable approach where checksum recomputation can be enabled only for retry attempts?
Something along the lines of an opt-in setting could preserve the current default behavior while supporting mutable data sources that may change between retries.
I'm interested in exploring the implementation and can investigate the feasibility if this approach aligns with the project's direction.
Activity
lucix-aws commentedon Apr 14, 2026
The behavior here is intentional (it was a recent change), converting to feature request.
[-]Checksum Error on Retry With io.Reader Under Write Contention[/-][+]allow fresh computation of flex checksum on retry[/+]abhinav-1504 commentedon May 30, 2026
I took a look at the issue and the related checksum middleware logic. Since the current behavior is intentional for performance reasons, would maintainers be open to a configurable approach where checksum recomputation can be enabled only for retry attempts?
Something along the lines of an opt-in setting could preserve the current default behavior while supporting mutable data sources that may change between retries.
I'm interested in exploring the implementation and can investigate the feasibility if this approach aligns with the project's direction.