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

Ensures request.Request's body is always an offset reader #871

Closed
wants to merge 1 commit into from

Conversation

xibz
Copy link
Contributor

@xibz xibz commented Oct 4, 2016

Added a new field body to request.Request. This will keep an offsetReader which will be used for copying requests when retrying. In addition, offsetReader now implements a Seek function.

Fixes #868

@jasdel jasdel self-assigned this Oct 4, 2016
jasdel added a commit to jasdel/aws-sdk-go that referenced this pull request Oct 5, 2016
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
@jasdel
Copy link
Contributor

jasdel commented Oct 5, 2016

Dropping this PR in favor of #874

@jasdel jasdel added the duplicate This issue is a duplicate. label Oct 5, 2016
@jasdel jasdel closed this Oct 5, 2016
jasdel added a commit that referenced this pull request Oct 6, 2016
* 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
@jasdel
Copy link
Contributor

jasdel commented Oct 6, 2016

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.

@xibz xibz deleted the request_body_race branch December 7, 2016 19:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue is a duplicate.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants