Fix zombie git processes by ensuring Wait() is called on all error paths#497
Open
cshung wants to merge 1 commit intohound-search:mainfrom
Open
Fix zombie git processes by ensuring Wait() is called on all error paths#497cshung wants to merge 1 commit intohound-search:mainfrom
cshung wants to merge 1 commit intohound-search:mainfrom
Conversation
In HeadRev(), if io.Copy fails after cmd.Start(), the git rev-parse process is never Wait()'d, leaving a zombie. In AutoGeneratedFiles(), if attributesCmd.Output() fails after filesCmd.Start(), the git ls-files process is never Wait()'d, leaving a zombie. Add the missing cmd.Wait() and filesCmd.Wait() calls on the error paths to prevent zombie processes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What kind of change does this PR introduce? (check at least one)
The PR fulfills these requirements:
If adding a new feature, the PR's description includes:
Other information:
Fixes #496
In
vcs/git.go, two functions can leave zombie git processes when error paths skip callingWait()on previouslyStart()-ed commands:HeadRev():io.Copyerror returns withoutcmd.Wait()on thegit rev-parse HEADprocess.AutoGeneratedFiles():attributesCmd.Output()error returns withoutfilesCmd.Wait()on thegit ls-filesprocess.This PR adds the missing
cmd.Wait()andfilesCmd.Wait()calls on the respective error paths, ensuring all started processes are properly reaped.