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

Egg race condition #1418

Merged
merged 3 commits into from Jul 20, 2018
Merged

Egg race condition #1418

merged 3 commits into from Jul 20, 2018

Conversation

pganssle
Copy link
Member

@pganssle pganssle commented Jul 11, 2018

Summary of changes

This PR is an approach to #1412 that adds a test to induce this race condition. The test relies on implementation details, but that is made explicit in the text of the test, I have done it this way because there isn't another great way to deterministically induce the problem.

cc: @JonKohler

Closes #1256

Pull Request Checklist

  • Changes have tests
  • News fragment added in changelog.d. See documentation for details

@JonKohler
Copy link
Contributor

Thanks for tackling this, I appreciate it! +1 from me

pganssle and others added 3 commits July 12, 2018 09:06
This mocks out the isdir call so that the directory is created
immediately after you determine whether or not it exists, thus
simulating a race condition between two threads or processes
creating the same directory.
This fixes a race condition in _bypass_ensure_directory where
two threads or processes may erroneously fail because they are
both creating the same directory. A more robust implementation
of this may involve exposing the un-wrapped os.makedirs.

Originally reported with proposed patch by @JonKohler in
github PR pypa#1412. This patch came out of discussions on that
thread.
@JonKohler
Copy link
Contributor

Where are we at on this? is there anything remaining?

Does this replace my original PR?

@pganssle
Copy link
Member Author

Yes this should replace your original PR since it solves the same problem in a different way. I've seen no objections since I opened this PR so I'm going to merge it.

@pganssle pganssle merged commit e2dde5b into pypa:master Jul 20, 2018
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

2 participants