Skip to content

Conversation

@obs-gh-justindaines
Copy link
Contributor

Fix will resolve "failed to rewind transport stream for retry" errors during S3 PutObject operations.

The AWS SDK retries failed PutObject requests, but the original request body (io.Reader) was not seekable, causing rewind failures on retry.

Fix:
Wrap the request body in a seekable io.ReadSeeker by reading it into memory first. This ensures retries can reset the stream position.

@obs-gh-justindaines obs-gh-justindaines changed the title fix: S3 wrap PutObject into ReadSeeker fix: S3 wrap PutObject into ReadSeeker - OB-51476 Oct 31, 2025
Copy link

@orca-security-us orca-security-us bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Orca Security Scan Summary

Status Check Issues by priority
Passed Passed Infrastructure as Code high 0   medium 0   low 0   info 0 View in Orca
Passed Passed SAST high 0   medium 0   low 0   info 0 View in Orca
Passed Passed Secrets high 0   medium 0   low 0   info 0 View in Orca
Passed Passed Vulnerabilities high 0   medium 0   low 0   info 0 View in Orca

Orca Security

@obs-gh-justindaines obs-gh-justindaines force-pushed the jdaines/s3-failed-to-rewind-transport-stream branch from 92237d4 to be03e1d Compare November 12, 2025 13:49
@obs-gh-justindaines obs-gh-justindaines force-pushed the jdaines/s3-failed-to-rewind-transport-stream branch from be03e1d to b9c3737 Compare November 19, 2025 15:49
// This allows AWS SDK to retry S3 PutObject operations by rewinding the stream
var body io.ReadSeeker
if r != nil {
data, err := io.ReadAll(r)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is still my original concern, we should avoid reading things into memory entirely unless fully necessary. It leads to OOMs if the data is too large. Readers should be preferred unless absolutely necessary vs reading into memory being the default

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants