Use class instance to lock signing #462
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The
with threading.Lock()
statement does not actually lockanything because we're creating a new lock each time. The
fix here is to use an instance level lock. We need to ensure that
the signer is not called in multiple threads as it is not thread
safe.
This bug surfaces via S3 signature version 4 multithreaded uploads.
If you run "aws s3 cp/sync" in eu-central-1 or cn-north-1, you'll
see signature errors because the timestamp will be off be one or more
seconds. Given this is a race condition, you'll need a fairly large
file (1GB to be safe) to see this issue.
Introduced in v0.86.0 of botocore (v1.7.5 of the AWS CLI).
cc @danielgtaylor @kyleknap