Open edhgoose opened 1 year ago
Have you ever seen it crash when running without --debug
? (My guess is no.)
I've seen it hang too, and it's very annoying when it happens. My theory is that there are situations where a background fetch never returns, and so the pull/push waits forever to grab the "global" sync mutex.
For me, it seems to have something to do with sleep mode. I think I have seen it only when lazygit was running when I put the MacBook to sleep, and then after waking up the next fetch/pull/push would hang. Not always though. So one theory could be that if you put the machine to sleep while a background fetch is running, it will then never return after waking up again. I have no idea why it would behave this way though, or what to do about it if it's true.
or what to do about it if it's true.
Add a kill after a timeout? So that a goroutine lives e.g. 30s or less?
I don't think that would be a good idea. In very large repos, fetching can easily take much longer than 30s.
Good question @stefanhaller - I don't think I have seen a crash when running without --debug
.
One thing I think is true (but I'll keep an eye out for) is that when it does hang, the command window doesn't populate with the git command. It'll just have Push
in the window, but not the git command. It's like the command isn't even executing. Maybe that's useful?
This only confirms that the Push command is still blocking on the global sync mutex (but we know this already from the logs); it will only log its command once it aquired the mutex, which it never does.
What we need to find out is why the other process (the background fetch) never finishes.
Ah, I'm with you. Is there anything I can do to help try and track that down?
I don't know; do a bit of research, perhaps? I'm not very experienced with networking stuff. A very cursory google search turned up this, which sounds somewhat related. I suppose more reading might be necessary.
Am I right in saying that you think the issue is not to do with lazygit itself, but actually git? I was working to the former, but sounds like you think it might be the latter?
Depends on how you look at it. It does have to do with lazygit insofar as its management of the global sync mutex goes, and how it assumes that no process will hold on to it forever. (Well, I suppose this is true of any mutex.)
But yes, I think the issue stems from the git fetch
background process never returning, and that seems outside of lazygit's control.
Of course, there's also the possibility that the git fetch
process is actually fine, and it only hangs because of the way we poll for its completion in go. But that would point to a problem in go's exec module, which seems less likely to me.
I also encountered the same problem. lazygit would always hang when pushing, and then it would take a long time to succeed.
Describe the bug When pulling or pushing a branch lazygit will occasionally crash.
To Reproduce It's really difficult to figure out what's occurring - not all
pull
's/push
's fail, and the majority of the time lazygit works fantastic.I haven't been able to create a reproduction step, but am happy to try out things if you've any suggestions.
Some things I've noticed that might be useful:
git
usually unglitches thingsExpected behavior I'd expect lazygit doesn't hang and doesn't crash :)
Screenshots N/A
Version info: Run
lazygit --version
and paste the result herecommit=5e388e21c8ca6aa883dbcbe45c47f6fdd5116815, build date=2023-08-07T14:05:48Z, build source=binaryRelease, version=0.40.2, os=darwin, arch=arm64, git version=2.39.2 (Apple Git-143)
Run
git --version
and paste the result heregit version 2.39.2 (Apple Git-143)
Additional context Add any other context about the problem here.
I've started running in
--debug
mode, and I usually get a deadlock like this one:Note: please try updating to the latest version or manually building the latest
master
to see if the issue still occurs.