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 lock directory to prevent race conditions #5276
Conversation
The page for the lockfile package says that the package is deprecated and On Mon, Oct 19, 2015 at 11:38 AM, Michael Droettboom <
|
Thanks for catching. What a pain, though. lockfile has been around forever and is well-tested (and actually has received updates more recently than fasteners) and does what we need and no more. fasteners has a lot more extra stuff -- but I guess if that's the future, that's where we are. |
I don't think fasteners is even the appropriate tool here. It provides for thread locks or interprocess locks, but not file system locks for processes that don't even know about each other (which is our use case). I think it's odd to recommend a package that doesn't even do the same thing. I think I'd prefer to stick with |
Agreed. The alternative package that they recommend is oslo.concurrency On Mon, Oct 19, 2015 at 11:57 AM, Michael Droettboom <
|
On 2015/10/19 5:57 AM, Michael Droettboom wrote:
Looking at the documentation, I don't see how the interprocess lock is |
It would seem from Travis-CI that the other problem with lockfile is that it doesn't install cleanly on Python 2.x. I'll try again with fasteners. |
Conda have a tried and tested lockfile implementation that we could lift... https://github.com/conda/conda/blob/master/conda/lock.py - surely this must work on all their supported platforms. |
Thanks, Phil. That might work. My understanding is that the mkdir approach is the only cross-platform one (there are other, better options on *nix but those don't work on Windows). |
# Keep the string "LOCKERROR" in this string so that external | ||
# programs can look for it. | ||
lockstr = ("""\ | ||
LOCKERROR: It looks like conda is already doing something. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should probably change this to not say conda.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, I'll just take this out -- I took out the message that was displayed here anyway. I don't think the message is terribly useful in our use case.
Sorry for the quality of this PR. I was working on this between millions of test runs on another PR. I keep forgetting I'm not much of a multitasking OS... |
...when creating the font cache
Ok -- I've address the comments. I also squashed the commits, because this went on a number of divergent paths to get here... |
I think this is good to merge. The old hacks to get around this bug have been removed, and Travis-CI is still happy. |
Use lock directory to prevent race conditions
Lets see how travis behaves in the long run |
Is this patch going to make it in to the 1.5.x release? I don't see it on that branch although I may just be looking in the wrong place. |
It wasn't milestoned for that -- there's a fairly high probability for unintended consequences here. But I could be convinced otherwise if it gets enough testing. |
ok, we can work with the |
Use lock directory to prevent race conditions Conflicts: lib/matplotlib/font_manager.py
This check was removed on master as a part of matplotlib#5276 which was backported But the backport missed this line. Given that we warn about creating the cache this check is really annoying as it will show up over and over again
Backported to 2.x as 56a932c |
Creation of the font cache has race conditions.
Adds a dependency on lockfile. We could vendor it if we want to, but the last thing I want to do is maintain cross-platform lockfile code...Fix #5226.