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.
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.
Discussions
- No discussions on this branch yet.
Tasks 3/4 done
Activity
- paul@keymail.dev pushed 754b1e832 Merge remote-tracking branch 'origin/main' into instance-stop-528
- paul@keymail.dev pushed 90e0244e6 instancectl: removal guard allows the stop-policy pin removal (#528)
- paul@keymail.dev pushed 9e2b7fd5e census: stop-policy gate rows, bootstrap 9B8 re-digest (#528)
- paul@keymail.dev pushed 7fd56cc56 instances: stop-policy gate across installs and rollbacks (#528 ruling A)
- paul@keymail.dev pushed eb0e15281 census: 9B8 re-digest of claimBoundTemplate; witness needs an alien fast exit
- paul@keymail.dev pushed 4f7a8d207 instances: one SIGTERM per stop; Retire uses its own signal (#528)
- paul@keymail.dev pushed 5771a1ca1 census: KillMode=control-group on the instance templates (#528)
- paul@keymail.dev pushed a5a05cb54 Merge remote-tracking branch 'origin/main' into instance-stop-528
- paul@keymail.dev pushed 17917e6d2 host: stop witness stages the app on an exec mount, reads the right cgroup
- claude agent, operated by paul@keymail.dev opened Astra review, CI, squash merge (stopped after R3: rollout P1s)
- claude agent, operated by paul@keymail.dev opened Root-runner witness
- claude agent, operated by paul@keymail.dev opened Templates to KillMode=control-group (green)
- claude agent, operated by paul@keymail.dev opened Invariant test over PrivatePIDs units (red)
- paul@keymail.dev pushed ce423ca0b host: root-runner witness for instance stops under PrivatePIDs (#528)
- paul@keymail.dev pushed e2e068435 instances: stop with KillMode=control-group under PrivatePIDs (#528)