Repository navigation
mcpx: zombie-aware liveness for daemon stop checks (#16312) - #17040
Merged
Merged
Conversation
added 3 commits
November 30, 2026 01:03
ProcessAlive (internal/daemon) and daemonAlive (internal/e2e) probed with signal 0 only, which reads an unreaped zombie as alive; where PID 1 does not reap orphans a stopped daemon then reads as alive past every cleanup bound even though its shutdown completed. Both checks now treat a zombie as dead: processExited is promoted from the daemon package's test helpers into production (linux /proc stat, darwin sysctl, signal-0 fallback elsewhere) and ProcessAlive consults it after a successful probe; daemonAlive and the cleanup assertion in TestEnvCleanupStopsTheDaemonItStarted consult e2e's existing exited helper. EPERM semantics unchanged.
TestAddingAServerIsLiveWithoutARestart and TestSecretSetAndUnsetOverTheSocket were quarantined under #1973 pending the root cause of their cleanup failures; the zombie-aware liveness fix in the previous commits is that root cause's fix, so the exemption is removed rather than left to expire on 2026-12-31. This commit is separable: if the pair does not pass its gate, the lift is reverted and the fix references #16312 instead of closing it.
|
Important Review skippedBot user detected. To trigger a single review, invoke the
|
This was referenced Nov 30, 2026
Closed
This was referenced Nov 30, 2026
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.
Fixes #16312
Root cause
The mcpx daemon's shutdown was never slow: lane 0640-GF's SIGQUIT diagnostic (run 46330420941, verdict on #16312) showed the daemon reaching exit in ~1ms. The "daemon alive 30s after stop" survivor is an unreaped zombie — the daemon is autostarted
Setsid+Process.Releaseby a CLI that exits, so its parent is the container PID 1, which does not reap orphans in the executor; both liveness checks probed withsyscall.Kill(pid, 0), which succeeds for zombies:daemon.ProcessAlive(internal/daemon/paths.go), used by the e2e cleanup sweepdaemonAlive(internal/e2e/e2e_test.go), used by the post-stop poll, plus a raw signal-0 assertion inTestEnvCleanupStopsTheDaemonItStartedThe same mechanism produced the three "daemon(s) still alive after stop --all" cleanup failures on #8465.
Change (3 commits)
TestProcessAliveReadsAZombieAsDead(daemon) andTestDaemonAliveReadsAZombieAsDead(e2e): spawn a child, kill it, do not reap it, require the liveness check to read it as dead. Both failed on the unfixed code (fleet run 46332636235:ProcessAlive(8548) reports a killed, unreaped child (a zombie) as alive; same fordaemonAlive).processExitedhelper (from mcpx: TestScriptViewCommandTimeoutKillsSpawnedWorkers fails in Fleet executor containers #13713) is promoted to production: Linux reads/proc/<pid>/stat(stateZ= exited), darwin readskern.proc.pidviagolang.org/x/sys/unix(SZOMB), other platforms keep the signal-0 fallback.ProcessAliveconsults it after a successful probe (EPERM semantics unchanged);daemonAliveand the cleanup assertion consult e2e's existingexitedhelper.TestAddingAServerIsLiveWithoutARestartandTestSecretSetAndUnsetOverTheSocket; if this commit ever needs to go, the fix stands on its own and this PR should reference mcpx: e2e suite hangs intermittently on aarch64-darwin (different test each run; daemon-side, reload path) #16312 instead of closing it.No new dependencies:
golang.org/x/syswas already a direct requirement; the darwin file uses its existingunix.SysctlKinfoProc.Gate (all at head e769e6b, read from the job logs)
-race -shuffle=on -count=5— run 46333433654: 5/5 PASS each, 0 skips, no leak errors.go test ./internal/e2e/ -run TestCoverage -count=1 -v— run 46333440723: 11 run / 11 PASS / 0 fail, includingTestCoverageCLIAdapterList(the test that failed on main with the leak error).internal/daemonpackage ok;TestEnvCleanupStopsTheDaemonItStarted,TestExitedTellsALiveProcessFromAGoneOne,TestDaemonAliveReadsAZombieAsDeadPASS (zombie test: 0.05s, vs the 5s deadline failure pre-fix).internal/daemontest-compiles clean. (A Linux-executorGOOS=darwinbuild attempt fails inruntime/cgo—gcc: unrecognized option '-arch'— an executor toolchain limit, not this change; the macOS run is the darwin record.)gofmt -lclean on both packages.Not in scope: the #16797 restart/attach failure is a different mechanism (0640-FB's slice) and the restart/attach path is untouched. Signal-0 helpers in
internal/pool/internal/mcpclientand e2e'sprocessExistsanswer different questions (foreign-process existence) and are unchanged.Lane 0640-GS (Felix). Merge is Felix's call.
{ "direct_parent": null, "links": [], "lineage": { "design": null, "roadmap_item": null, "priority": null }, "pm_meta": 1, "provenance": { "queue_id": null, "scheduled_start": null, "picked_up_at": null, "work_started_at": null, "created_at": "2026-11-30T01:46:41Z", "session_id": null, "lane": null, "host": "htch-runtime", "worktree": "/home/hatch", "model": null, "lane_start_issues": [], "workspace_ref": { "kind": "worktree", "id": "/home/hatch", "repo": "developing-today/code", "branch": "main", "sha": "010b47d1c4cecdcd1b7d6ea260b7c9b0a61fb89e" }, "auth_subject": "felix", "stamped_by": "fleet 0.1.0 (native)" } }Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.