Skip to content

fix: add zombie process reaper for PID 1 containers#153

Merged
alecthomas merged 1 commit intomainfrom
aat/fix-zombie-processes
Feb 24, 2026
Merged

fix: add zombie process reaper for PID 1 containers#153
alecthomas merged 1 commit intomainfrom
aat/fix-zombie-processes

Conversation

@alecthomas
Copy link
Collaborator

When cachewd runs as PID 1 in a container, orphaned grandchild processes (e.g. git-upload-pack spawned by git http-backend) get reparented to it. Go's cgi.Handler properly reaps the direct child but has no mechanism to reap these grandchildren, so they accumulate as zombies.

Adds a background reaper that periodically calls waitpid(-1, WNOHANG) to collect any zombie children. It only activates when running as PID 1.

Fixes #151

When cachewd runs as PID 1 in a container, orphaned grandchild processes
(e.g. git-upload-pack spawned by git http-backend) get reparented to it.
Go's cgi.Handler properly reaps the direct child but has no mechanism to
reap these grandchildren, so they accumulate as zombies.

Add a background reaper that periodically calls waitpid(-1, WNOHANG) to
collect any zombie children. It only activates when running as PID 1.

Fixes #151
@alecthomas alecthomas requested a review from a team as a code owner February 24, 2026 06:20
@alecthomas alecthomas requested review from nssherpa and removed request for a team February 24, 2026 06:20
@alecthomas alecthomas enabled auto-merge (squash) February 24, 2026 06:20
@alecthomas alecthomas merged commit e11c4f1 into main Feb 24, 2026
5 checks passed
@alecthomas alecthomas deleted the aat/fix-zombie-processes branch February 24, 2026 06:21
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.

We're leaving zombies

1 participant