-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Error Occurs When Closing File After Uploading Via S3.PutObject #869
Comments
Hello @MikeMangialardi, thank you for reaching out to us. I will take a look at this and see what is going on. Thank you for providing some code to test with! |
@MikeMangialardi, it looks like in |
Interesting. You may want to change the interface that you accept for the Body parameter in that case. Because you accept an io.ReadSeeker, which does not have a Close() method,I assumed that your library wouldn't close the file. Either way, thank you for for your prompt and thorough response! |
Thanks for the feedback, @MikeMangialardi. PR #871, is looking to fix the underlying issue that you encountered. Specifically, that the SDK's retry logic allowed the raw io.ReadSeeker to make its way to the |
@jasdel Thanks for the response! That makes sense, and I will work around until that PR is approved and merged. |
@MikeMangialardi - After reading my response, it made it seem like we weren't going to do anything about it. Yes, with the PR #871, this should resolve this issue. Sorry for the unclear response. It wasn't my intention! |
Fixes the possible race conditions where the SDK's request body could be mutated by the HTTP request directly. This could occur because the SDK did not consistently protect the SDK's request#Request.Body parameter from the http#Request.Body. This inconsistency prevented the SDK from protecting against race conditions when HTTP Client's Transport would still be reading on the http#Request.body and the SDK would be attempting to retry the API operation. During a API operation retry the request#Request.Body needs to be rewound for then next retry of the HTTP request. This is protected now by creating a strong separation between the request#Request.Body and http#Request.Body. A per request wrapper is created for each HTTP request attempt that is safe to use concurrently. Fix aws#868, aws#869, aws#871
* aws/request: Fix HTTP Request Body race condition. Fixes the possible race conditions where the SDK's request body could be mutated by the HTTP request directly. This could occur because the SDK did not consistently protect the SDK's request#Request.Body parameter from the http#Request.Body. This inconsistency prevented the SDK from protecting against race conditions when HTTP Client's Transport would still be reading on the http#Request.body and the SDK would be attempting to retry the API operation. During a API operation retry the request#Request.Body needs to be rewound for then next retry of the HTTP request. This is protected now by creating a strong separation between the request#Request.Body and http#Request.Body. A per request wrapper is created for each HTTP request attempt that is safe to use concurrently. Fix #868, #869, #871
@MikeMangialardi I just merged #874, and this fixes the issue of the SDK's Request reader potentially encountering race condition. Let us know if you have any issues, or feedback. You should be able to consistently close the file provided to SDK's requests now. |
Title is pretty self-explanatory. I open a file and upload it to S3 using PutObject. After upload is complete, an "Invalid argument" error is thrown when I attempt to close the file. Sample code below will reproduce the issue:
The text was updated successfully, but these errors were encountered: