Repository navigation
daemon: warn at startup when running as PID 1 - #496
Merged
Merged
Conversation
As the entrypoint of a container started without an init, the daemon is handed every orphaned process. The servers its apps start daemonize (redis-server, postgres), so they end up as children of PID 1 and stay zombies after they are stopped: Go only waits for children it started. The daemon does not reap them. A wait for any child also takes the exit status of the apps the supervisor is waiting on (measured: 17 of 300 exec.Cmd.Run calls failed with "waitid: no child processes" next to a wait4(-1) loop). Reaping belongs to an init process, so on Linux the daemon now logs one warning when it is PID 1, and the README's install notes say to use `docker run --init` or tini. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…d changelog wording From review: Kubernetes and Fargate have no --init, so name shareProcessNamespace and initProcessEnabled; say zombies count against the container's PID limit and that no warning does not prove another PID 1 reaps; fix the changelog's tense and a test comment. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
TeoSlayer
force-pushed
the
fix/daemon-pid1-warning
branch
from
October 7, 2026 13:09
6e45139 to
090e8ff
Compare
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.
Pull Request
Summary
In a container where
pilot-daemonis PID 1, servers that apps start and daemonize (redis-server, postgres) are re-parented to it and stay as zombies when stopped: Go does not reap children it did not start. Seen in a lab asZprocesses under PID 1.Changes
docker run --init, Composeinit: true, or tini as the entrypoint.No reaper is added, deliberately. A
wait4(-1)loop steals exit statuses fromexec.Cmd.Wait: in an experiment it lost 17 of 300, which in the app supervisor becomes exit code -1 with the real code gone.Test Plan
go build ./...,go vet ./..., unit suite withGOWORK=off--initChecklist
go.mod/go.sumunchanged🤖 Generated with Claude Code