Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Close http.Response.Body in S3 CopyObject, UploadPartCopy and CompleteMultipartUpload operations. #4045

Merged
merged 3 commits into from
Aug 17, 2021

Conversation

ashtuchkin
Copy link
Contributor

Fixes #4037. See that issue for more details.

Note, in case of read error we don't close the body because later Unmarshal hooks expect it to not be closed (they close it themselves). There's an existing test guarding that behavior.

Close error is ignored as it has no side effects and there's nothing we can do about it.

Copy link
Contributor

@jasdel jasdel left a comment

Choose a reason for hiding this comment

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

Thanks for creating this PR @ashtuchkin, and fixing the response body not being closed in case of 200 status code with error.

The change looks good, minor comment about using defer for body

service/s3/statusok_error.go Show resolved Hide resolved
@ashtuchkin ashtuchkin requested a review from jasdel August 4, 2021 19:30
Copy link
Contributor

@jasdel jasdel left a comment

Choose a reason for hiding this comment

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

Looks good, Thanks for creating this PR and fixing the bug. We'll get this merged in, and released.

service/s3/statusok_error.go Show resolved Hide resolved
@rittneje
Copy link
Contributor

@jasdel When will this be merged?

@jasdel jasdel merged commit 6f36a81 into aws:main Aug 17, 2021
@mikeparker
Copy link

mikeparker commented Sep 21, 2021

Does this fix #3549? (Multi-part upload to S3 leaves open X-ray subsegment )

@ashtuchkin
Copy link
Contributor Author

I think it should, but have no way to check.

@ashtuchkin ashtuchkin deleted the fix-close-bug branch September 21, 2021 21:49
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.

S3 operations CopyObject, UploadPartCopy and CompleteMultipartUpload don't close http.Response.Body
4 participants