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

Use class instance to lock signing #462

Merged
merged 1 commit into from
Feb 13, 2015
Merged

Conversation

jamesls
Copy link
Member

@jamesls jamesls commented Feb 13, 2015

The with threading.Lock() statement does not actually lock
anything 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

The `with threading.Lock()` statement does not actually lock
anything 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.
@jamesls
Copy link
Member Author

jamesls commented Feb 13, 2015

Should mention that I'll add an integ test to s3 for this.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.0%) to 94.27% when pulling d8ced45 on jamesls:lock-signer into 686d471 on boto:develop.

@kyleknap
Copy link
Contributor

🚢

@danielgtaylor
Copy link
Member

👍

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.

4 participants