Skip to content

Use class instance to lock signing - #462

Merged
jamesls merged 1 commit into
boto:developfrom
jamesls:lock-signer
Feb 13, 2015
Merged

jamesls merged 1 commit into
boto:developfrom
jamesls:lock-signer

Conversation

@jamesls

@jamesls jamesls commented Feb 13, 2015

Copy link
Copy Markdown
Member

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

jamesls commented Feb 13, 2015

Copy link
Copy Markdown
Member Author

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

@coveralls

Copy link
Copy Markdown

Coverage Status

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

@kyleknap

Copy link
Copy Markdown
Contributor

🚢

@danielgtaylor

Copy link
Copy Markdown
Contributor

👍

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