-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
git.exe parent process locks index file for child git.exe process #770
Comments
Which ones?
This version was released on March 18th, and there have been no less than four releases since then, each of which with its respective number of fixes. The smart thing would be to verify that this is still an issue with Git for Windows v2.8.3.
It is unlikely that this comes as a surprise to you: this does not reproduce the problem here. |
#500, #446, #233
I am really sorry to inform you that the sequence of command used to trigger the issue is just "git pull". I will try harder next time. To get serious, I thought the info I provided does give a good lead to find the issue. Now I dont mind installing another version, providing logs, or whatever, but I do not feel that you actually followed the information I did provide. Do you want me to install v2.8.3? |
You do not need to be sorry about this. All it means is that I cannot reproduce this issue here, and therefore I am unlikely to be able to help. So it is me who is sorry. |
@dscho: This looks like the same cause as #755 (which I think also holds for the other issues) On both linux and windows file handles are inherited by child processes, Might we extend the solution of #755 to all open calls? That would of course mean, figuring out if we can make git-upload-pack et al. work with this... |
@bwijen but that I guess that we need to insert a Which would require some real work... And somehow I wonder whether @hzshlomi will do that. |
@dscho you know, at this point, it actually gets interesting. look here: http://stackoverflow.com/help/mcve. |
@hzshlomi Just to say, 'be careful of what you wish for'. Given that Git is not designed for Windows, and that without @dscho's continued perseverance, we would not even have what we have now. Research does show that it's only by using tests first view of Test Driven Development (and in this case, particularly for tricky 'bug' cases) that you actually get any improvement in efficiency. So this problem need a "Test", which is what an MVCE is. Without an easy way to poke the bug, we won't know if we've found it, or fixed it, nor let it come back via some regression in future change. So anything you can do to even create a 30 (or however many it takes) line test script that will 'just work' in the SDK would be a start, so then it can be tightened and tightened like a noose around the bug. This may require a bit of google archaeology to bring together all the historic bits. Someone, anyone, need to provide some time into the problem, if they have it. For that is the limited resource. @dscho can do wonders when pointed in the right direction by a good MVCE, but he is a VOLUNTEER. So if you can volunteer a short test script 'that just runs' easily, then that would be a start. I appreciate your time may be as limited as dscho's but if you need it fixed ... |
@PhilipOakley @dscho, thank you very much for the wonderful job you guys are doing for the community. I mean every word, no cynicism, not one bit. I really do appreciate every second of your time put into it. Having that said, the reason I reported is that I know other people that faced the issue and had varying degrees of success walking around the problem (I just use Win, Linux interchangeably). So, to a lesser degree, I was too giving a very modest contribution, not looking for a free service but donating an input. While doing so, I do not expect reactions like: "It is unlikely that this comes as a surprise to you: this does not reproduce the problem here." That tone is not called for. If you decide to contribute, go ahead. Mocking is not a contribution. I also did and still do am willing to put some time into it, just like I wrote before. If I knew the code, I would do it, but I don't. @PhilipOakley Thank you too! |
Hmm, you are right...
@dscho: If that is the case, this needs to be fixed upstream right? I will try to create a mcve, to see if I'm right about the cause... |
@bwijen eventually, yes. The way I prefer to work on Windows-related issues is to get them fixed in Git for Windows first, to be able to verify the fix, and then (leisurely) submit the fixes upstream.
Awesome, thank you! (happy) |
$ cat mcve-770.sh git init origin $ ./mcve-770.sh |
$ git --version $ ./mcve-770.sh |
MCVE - done. |
I cannot reproduce on a Win7 32 bit VM.
|
@bwijen |
I will retry tomorrow on a 64bit system |
Tried it on another friend's computer, did NOT reproduce. Will see what's the difference. |
Also tried it on a Win7 64-bit system, could NOT reproduce... |
@hzshlomi I had an old
Then, I upgraded to latest
@hzshlomi Use triple backticks when posting code snippet in comments, this will nicely format them in a code block like above. Furthermore, it will avoid losing the backticks `. Here the reformatted MCVE slighlty modified:
|
I just ran into the same issue and I have a reproducible test case here (branch based on Git for Windows 2.9.2): I use the latest Git for Windows SDK, I
This is what I get:
My machine:
Unfortunately my test is not minimal as it contains a new feature that I am working. However, the feature and the tests run clean on OS X and Linux. Plus my code does not open a the Can you give me a hint how to debug this further? |
OK. I think I found a workaround. If I kill my child process right before |
New theory:
|
Would something like
resolve the issue? |
As I understand it the default behaviour for CreateProcess is that file handles are not inherited (https://msdn.microsoft.com/en-us/library/windows/desktop/ms683463(v=vs.85).aspx); but the above change is worth a shot just to rule that out. |
Thanks @whoisj ! That is definitively a step into the right direction! @sinbad: Right now all handles are inherited because Git Source Unfortunately, the snippet above does not work because the process does not even inherit the stdin/stdout handles. I try to enable inheritances for stdin/stdout explicitly but no luck so far: |
In my Git for Windows SDK Does anyone see an easier approach to this problem? |
OK, different approach. Instead of selectively disabling the inheritance on process creation, I disable inheritance when the file is opened in the parent process (similar to the solution here). This seems to work fine:
Do you think this would have undesired implications? |
I worry about the effects on "internal files", like the index and pack files. I think this makes perfect sense for worktree files. |
Thanks @whoisj ! Could you review, and if applicable, acknowledge the patch on the mailing list? |
I'll review the patch manually ASAP, but I am not setup, currently, to do anything with the mailing list. (looks at Exchange with a bitterness) |
@larsxschneider I've sorry to report that I was not able to get to the review today, and I'm leaving on vacation in just a few hours. I highly doubt the family would be very appreciative of my spending time reviewing code on vacation, but I'll attempt to find some time. At worse, I'll return in a week and find time them. Again, apologies for the delay. |
@whoisj No worries at all! Enjoy your vacation and please don't look at the code before you return 😎 |
The fix was already included in the latest Git for Windows version. Closing. |
@dscho I just send out a fix to the Git mailing list: http://public-inbox.org/git/20161024180300.52359-1-larsxschneider@gmail.com/ |
I did see similar closed issues
Setup
MINGW64
$ git --version
git version 2.7.4.windows.1
Win7 64 bit
defaults?
pull+rebase
Details
Bash (MINGW64), no other GUI tool installed
git pull
to be updated against remote
it triggered "Auto packing" and failed (see output message below), while the process holding the lock was .. "git.exe":
git.exe (pid=34040; "git pull")
-> git.exe (pid=28552; "git fetch -update-head-ok")
-> git.exe (pid=12732; "git gc -auto")
-> git.exe (pid=12732; "git repack -d -l -A --unpack-unreachable=2.weeks.ago")
where 34040 holds "006efeeb01a6252adb97aafb1cbb04232f915794.idx",
and 12732 fails to unlink it.
The output:
Auto packing the repository in background for optimum performance.
See "git help gc" for manual housekeeping.
Counting objects: 309941, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (72671/72671), done.
Writing objects: 100% (309941/309941), done.
Total 309941 (delta 186940), reused 301892 (delta 181069)
Unlink of file '.git/objects/pack/pack-006efeeb01a6252adb97aafb1cbb04232f915794.idx' failed. Should I try again? (y/n) y
The text was updated successfully, but these errors were encountered: