-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Defunct Git Processes left lying around #3242
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
Comments
I fixed it locally in /vendor/code.gitea.io/git/commit-info.go: |
@trebonian could you send a PR to |
Not sure how to do it without a fork of gitea on github.
EDIT: change the formatting so it's readable // BKC |
I don't think calling |
its deferred until this routine returns - which I assumed meant all the log output was processed. |
@trebonian No, the function may return without processing all of the |
@ethantkoenig then whoever processes the last output needs to do a "Wait" otherwise zombies will be left lying around |
It was my understanding that |
Thanks - the symptom that I am seeing is that there is a new "git" zombie processes after every invocation of gitCommitsInfo. I am not sure how the Golang runtime handles the "cancel" but the main process needs to do an OS wait on the child process id (at the linux level). I don't know how it can do this if the only handle to that child process is lost after gitCommitsInfo returns. |
PS - it should only call the Wait if we know the child is done - otherwise we will block the main process. |
I think @trebonian is right. |
I think @ethantkoenig is correct, and we don't want the main process to block - but I also think we need to call cmd.Wait() in the main process when the cmd'ed process terminates. Note that the current code does not seem to check for any kind of process error while the cmd is running. I did the following after the cmd.Start() and it seems to work: This starts a goroutine that will wait until the process exits. This seems to fix up the zombies - but it's not the nicest. I am not sure, but I think there needs to be something with a "done" channel to detect and report process errors (like getting killed, or signalled while running), and the cmd process done detection is merged with the other thread done check's lower down. |
go func () { cmd.Wait() }() seems work. Or maybe handle the error and write to log. |
After running benchmarks, it looks like calling Current implementation (creates defunct processes):
Proposed changes:
I will send a fix to https://github.com/go-gitea/git. |
[x]
):Description
After running any operation that uses the new commit-info module on a directory - it leaves a defunct process lying around saying "[git] " in the list of processes.
...
Screenshots
The text was updated successfully, but these errors were encountered: