Skip to content

Can't use in concurrence #2

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

Closed
xtuc opened this issue May 30, 2019 · 0 comments · Fixed by #3
Closed

Can't use in concurrence #2

xtuc opened this issue May 30, 2019 · 0 comments · Fixed by #3

Comments

@xtuc
Copy link
Member

xtuc commented May 30, 2019

🐛 Bug description

From my understanding here are the steps that download does:

  1. defines a destination (return if already exists)
  2. download and extract in a temporary directory
  3. rename the temporary directory to the final destionation

Now imagine a concurrent install is running, if after the step 1. another installation succedeed the rename (step 3.) will fail (however, only under Linux because of different syscalls).

🤔 Expected Behavior

Work

👟 Steps to reproduce

Use download with the same package concurrently (in multiple cargo test for example).

🌍 Your environment

Include the relevant details of your environment.
binary-install version: master
rustc version: 1.36.0-nightly
OS: Linux

xtuc added a commit to xtuc/binary-install that referenced this issue May 30, 2019
Download does the following steps:
1. defines a destination (return if already exists)
2. download and extract in a temporary directory
3. rename the temporary directory to the final destionation

Now imagine a concurrent install is running, if after the step 1. another
installation succedeed the rename (step 3.) will fail
(however, only under Linux because of different syscalls).

This change allows to acquire a lock before step 1 and release it
after step 3. Concurrent access will wait.

Fixes rustwasm#2
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 a pull request may close this issue.

1 participant