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

Fix symlinking race condition #2765

Merged
merged 5 commits into from
Mar 31, 2017
Merged

Fix symlinking race condition #2765

merged 5 commits into from
Mar 31, 2017

Conversation

ericholscher
Copy link
Member

@ericholscher ericholscher commented Mar 30, 2017

I wonder if this is something we should have locking around?
I think we're hitting a case where multiple builds or celery runs on the webs
are causing a race condition in the symlinking code.

I'm guessing we'll still be hitting issues until we build locking code around this,
because it's pretty stateful. This is not a great fix, but at least stops the builds failing in these cases, I believe.

@ericholscher ericholscher added PR: work in progress Pull request is not ready for full review PR: ready for review and removed PR: work in progress Pull request is not ready for full review labels Mar 30, 2017
@ericholscher ericholscher requested a review from agjohnson March 30, 2017 22:13
Copy link
Contributor

@agjohnson agjohnson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, not sure on the best way around this. I guess it depends on what is creating the race condition -- multiple processes/threads creating these paths at the same time?

@@ -1,3 +1,4 @@
import errno
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this was brought in for this PR, it isn't used.

"""
Makedirs has an issue where it has a race condition around
checking for a directory and then creating it.
This catches the exception in this case.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The failure case isn't clear, perhaps expand on what this is protecting against.


try:
os.makedirs(directory_name)
except OSError:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this strictly catching makedirs created dirs that already exist? It seems that OSError would be thrown in a number of cases that we might care about.

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.

2 participants