Use flock() for file locking by expobrain · Pull Request #513 · gitpython-developers/GitPython
Repository navigation
Use flock() for file locking - #513
Merged
Byron merged 11 commits into gitpython-developers:master from expobrain:master Oct 9, 2016
Merged
Use flock() for file locking #513 Byron merged 11 commits into gitpython-developers:master from expobrain:master
Conversation
expobrain commented Sep 14, 2016 · edited by ankostis Loading
Copy link Copy Markdown
The problem with the original code is that the lock was based on the presence of the lockfile, that is if the lockfile exists the _obtain_lock() fails otherwise it succeed on acquiring the lock.
However this was problematic because between the check if the lockfile exists and the creation of the file another process can create the file as well resulting in a double lock, and we don't want to lock the same file twice :-)
expobrain added 5 commits September 12, 2016 17:19
Replaced lock file code with flock()
547e6f0
No need to create the lock file beforehand
6dfc870
Ignore cache dir of Py.test
1e4eff1
Updated AUTHORS
ae19557
Force GC collection
f0fcc07
Byron
added
waiting for feedback
acknowledged
labels
Sep 24, 2016
Byron commented Sep 24, 2016
Copy link Copy Markdown
Member
|
Thanks @expobrain for this valuable contribution, and @Alexxz for the initial review. Having glanced over the code, I'd believe it has a chance to work given that all unit-tests still succeed. However, I am not quite sure whether I would be willing to downright kill windows support, as Being very honest to myself, then admittedly I don't have access to windows and will not make such an attempt. Maybe there is someone working on windows who would be willing to take over maintaining support for that platform. I also believe that a major version increment would be a doable precondition for a merge. |
expobrain commented Sep 26, 2016
Copy link Copy Markdown
Author
|
Hi Byron, I'm more than happy to add the Windows support of this PR. Do you have any guidelines on how to develop and test GitPython on Windows? |
Byron commented Oct 1, 2016
Copy link Copy Markdown
Member
|
@expobrain Thanks a lot in advance ! Any help is appreciated and welcome. There are not many requirements when getting started contributing, and the few things there are have been added to the contribution guide . @ankostis Is working on integrating GitPython with AppVeyor as CI for windows in PR #519 , which I believe would be very beneficial for you to have. Alternatively, you just get started and focus on the tests that verify the locking specifically. Once they run on your machine locally, you could just push them into your PR to have travis verify nothing broke on the linux side. I hope you find this answer helpful, and that you can get started painlessly. |
ankostis commented Oct 1, 2016
Copy link Copy Markdown
Contributor
|
#519 is a gargatuan PR that I've been working for almost 2 weeks. |
ankostis commented Oct 2, 2016
Copy link Copy Markdown
Contributor
|
@expobrain can you rebase on master now that #519 is merged? |
391a767 to
8a2f7dc
Compare
October 4, 2016 00:12
Merge remote-tracking branch 'upstream/master'
26f9b9f
Conflicts: git/util.py
expobrain commented Oct 6, 2016
Copy link Copy Markdown
Author
|
Yes, doing it now |
Fixed typo after merge
d437f88
Updated file locking for Windows platform
ab7a872
Updated setup to include Windows requirements
c0b45fa
Forgot to uncomment conditional import
4c9dd7f
Fix syntax for Python 3.x
20b4f49
Byron
removed
the
waiting for feedback
label
Oct 9, 2016
Byron commented Oct 9, 2016
Copy link Copy Markdown
Member
|
Thanks a lot for your contribution, and to everyone else who has contributed to this PR ! |
ac9ac55
into
gitpython-developers : master
Oct 9, 2016
ankostis commented Oct 11, 2016 · edited Loading
Copy link Copy Markdown
Contributor
|
@Byron Appveyor fails on this :-( https://ci.appveyor.com/project/ankostis/gitpython/build/1.0.225 Have you logged-into Appveyor and add this project? |
ankostis commented Oct 11, 2016 · edited Loading
Copy link Copy Markdown
Contributor
|
@Byron This PR had caused me many Windows problems downstream - please revert. @expobrain If the old locking-code is problematic, we may look also into this alternative library: https://github.com/pakal/rsfile/blob/master/doc/locking_semantic.rst But I really miss an explanation what was the problem with the old code (add it in the OP). |
ankostis commented Oct 11, 2016
Copy link Copy Markdown
Contributor
|
Actually this PR has been reverted. @expobrain if you feel like you can address some of the issue we can revisit this one; but please first explain what was the problem with the old code. |
expobrain commented Oct 11, 2016
Copy link Copy Markdown
Author
|
@ankostis the problem with the original code is that the lock was based on the presence of the lockfile, that is if the lockfile exists the However this was problematic because between the check if the lockfile exists and the creation of the file another process can create the file as well resulting in a double lock, and we don't want to lock the same file twice :-) Thats all, I hope it makes sense. Thank you also to point us to the library, I'll have a look because looks more complete than my PR and also supports Windows out of the box. |