Kit containers do not reap orphaned processes: no Docker init, no SIGCHLD handling #1382
Notifications
Due Date
No due date set.
Depends on
Reference: sam/archie#1382
Reference in new issue
Block a user
What is wrong
internal/container/kit.go creates the Kit container with Config.User "0" and a HostConfig that sets only NetworkMode, Binds and Mounts. Nothing in the tree handles SIGCHLD, sets PR_SET_CHILD_SUBREAPER, or calls Wait4(-1).
archie-agent is the container's PID 1. Any process it does not itself wait on, and which is orphaned, reparents to PID 1 and becomes a zombie when it exits.
How it is reached
Impact
Zombie accumulation inside a long-lived container. The container's PID table is finite, so the failure is delayed and shows up as fork failures in the agent, not as a clear error.
Fix
Set HostConfig.Init = true so Docker runs its own minimal init as PID 1 and reaps orphans; no tini needs to be bundled into the image. Alternatively reap in the worker, but Docker's init is the smaller change.
Evidence
Acceptance criteria
a Kit container that orphans a background process reaps it (no zombie accumulation), or the worker reaps orphans itself.
Close reason
Verified: fixed in code or doc/file no longer exists (see burndown 2026-10-13)
Imported from beads
archie-core-in4q· GitHub #1556 · type bug · priority P2 · created 2026-10-08 · closed 2026-10-12