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

aws/request: Fix HTTP Request Body race condition. #874

Merged
merged 3 commits into from Oct 6, 2016

Conversation

jasdel
Copy link
Contributor

@jasdel jasdel commented 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 #868, #869, #871

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 Author

jasdel commented Oct 5, 2016

Reviewing this PR in place of PR #871.

@jasdel jasdel merged commit 83dcb59 into aws:master Oct 6, 2016
@jasdel jasdel deleted the fix/868RequestRace branch October 6, 2016 20:46
jasdel added a commit that referenced this pull request Oct 6, 2016
Service Model Updates
---
`service/cognitoidentityprovider`: Update Amazon Cognito Identity Provider service model
`service/devicefarm`: Update AWS Device Farm documentation
`service/opsworks`: Update AWS OpsWorks service model
`service/s3`: Update Amazon Simple Storage Service model
`service/waf`: Update AWS WAF service model

SDK Bug Fixes
---
`aws/request`: Fix HTTP Request Body race condition #874

SDK Feature Updates
---
`aws/ec2metadata`: Add support for EC2 User Data #872
`aws/signer/v4`: Remove logic determining if request needs to be resigned #876
@jasdel jasdel mentioned this pull request Oct 6, 2016
jasdel added a commit that referenced this pull request Oct 6, 2016
Service Model Updates
---
`service/cognitoidentityprovider`: Update Amazon Cognito Identity Provider service model
`service/devicefarm`: Update AWS Device Farm documentation
`service/opsworks`: Update AWS OpsWorks service model
`service/s3`: Update Amazon Simple Storage Service model
`service/waf`: Update AWS WAF service model

SDK Bug Fixes
---
`aws/request`: Fix HTTP Request Body race condition #874

SDK Feature Updates
---
`aws/ec2metadata`: Add support for EC2 User Data #872
`aws/signer/v4`: Remove logic determining if request needs to be resigned #876
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.

None yet

1 participant