Skip to content

Comments

Fix zombie git processes by ensuring Wait() is called on all error paths#497

Open
cshung wants to merge 1 commit intohound-search:mainfrom
cshung:fix/zombie-processes
Open

Fix zombie git processes by ensuring Wait() is called on all error paths#497
cshung wants to merge 1 commit intohound-search:mainfrom
cshung:fix/zombie-processes

Conversation

@cshung
Copy link

@cshung cshung commented Feb 11, 2026

What kind of change does this PR introduce? (check at least one)

  • Bugfix
  • Feature
  • Code style update
  • Refactor
  • Build-related changes
  • Other, please describe:

The PR fulfills these requirements:

  • All tests are passing?
  • New/updated tests are included?
  • If any static assets have been updated, has ui/bindata.go been regenerated?
  • Are there doc blocks for functions that I updated/created?

If adding a new feature, the PR's description includes:

  • A convincing reason for adding this feature (to avoid wasting your time, it's best to open a suggestion issue first and wait for approval before working on it)

Other information:

Fixes #496

In vcs/git.go, two functions can leave zombie git processes when error paths skip calling Wait() on previously Start()-ed commands:

  • HeadRev(): io.Copy error returns without cmd.Wait() on the git rev-parse HEAD process.
  • AutoGeneratedFiles(): attributesCmd.Output() error returns without filesCmd.Wait() on the git ls-files process.

This PR adds the missing cmd.Wait() and filesCmd.Wait() calls on the respective error paths, ensuring all started processes are properly reaped.

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Zombie git processes when git commands fail in HeadRev and AutoGeneratedFiles

1 participant