carlos / platform Public

instance-stop-528

Problem (#528). About a third of instance stops on the dev demo box (and a quarter of HA generation stops on sophie) end Result=signal: the app is SIGKILLed with no SIGTERM grace.

Root cause. systemd 257 under PrivatePIDs=yes forks once more inside the new PID namespace and races the intermediate parent's exit; when it loses, it marks the main process "not our child" (alien). At stop, unit_kill_context() returns "nothing to wait for" for an alien main, and KillMode=mixed signals nothing else in the SIGTERM phase, so systemd escalates to SIGKILL at once. Journal evidence: every signal failure (17 on the demo box, 73 on sophie) belongs to an invocation that logged "not our child"; none of the non-alien ones failed.

Fix. KillMode=control-group on the eleven tenant templates and the claim-bound template. The SIGTERM phase then also signals the tenant, so systemd waits up to TimeoutStopSec=20 as designed. An invariant test refuses any other KillMode beside PrivatePIDs=yes. Root-runner witness TestRootInstanceStopUnderPrivatePIDs reproduces the race with mixed and proves clean stops with the shipped template, plus a bounded kill of a tenant that ignores SIGTERM.

Spec: docs/superpowers/specs/2026-11-08-instance-stop-privatepids-528-design.md.

Human

Fix #528: PrivatePIDs instance units stop with KillMode=control-group, so a 'not our child' main PID no longer turns every stop into an instant SIGKILL.

Commits 11
Files changed 42 +1,808 −54
Discussions 0 0 open
Tasks 3/4 done

Activity