Repository navigation
Conversation
A local server is not the CLI's child, so when it exits PID 1 collects it. Where PID 1 does not (a container started without an init, such as `docker run` without `--init`), the server stays a zombie, which still answers `kill(pid, 0)`, and `zitadel stop` failed with "Local Zitadel server did not stop". On Linux the launcher now reads a process's state from /proc: a zombie is not running, and neither is a process group whose members are all zombies. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0137eGmVJawiDxhgvZh2ypMR
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Unreadable /proc entries can hide a live child process, causing stopPid to report success without escalating to SIGKILL instead of preserving the signal-based fallback.
1 open issue
What changed in this PR
Fixes local CLI shutdown checks so unreaped Linux zombie processes no longer cause zitadel stop to report failure.
Changes:
- Checks
/procfor live processes and process-group members. - Adds a Linux-only zombie-process regression test.
- Adds a CLI patch changeset.
| File | Description |
|---|---|
apps/cli/tests/unit/lib/server/local/internal/binary-launcher.test.ts |
Tests zombie and live-parent detection. |
apps/cli/src/lib/server/local/internal/binary-launcher.ts |
Adds process-state inspection to liveness checks. |
.changeset/cli-stop-unreaped-server.md |
Documents the container shutdown fix. |
Review effort: Balanced
groupHasLiveMember counted a /proc/<pid>/stat it could not read as no member, so where /proc is mounted with hidepid, a live member it may not read would not count, and stop could report the group gone without escalating to SIGKILL. procStat now tells a process that is gone (ENOENT, ESRCH) from one it cannot read, and an unreadable entry leaves the signal's answer standing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0137eGmVJawiDxhgvZh2ypMR
The repository's Biome plugin forbids `let`; procStat now parses inside the try and returns from each branch. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0137eGmVJawiDxhgvZh2ypMR
The group scan answered "gone" whenever /proc showed no member of the group, as under a /proc of another pid namespace or one that hides other users' processes, although the group still answered the signal. It now overrules the signal only where it sees members and all of them have exited, counts a process being collected (X) as exited too, and treats a stat line it cannot parse as unreadable. The zombie test is split into one claim per test and waits until the zombie leads its own group, so a setsid that forks fails it instead of leaving the scan untested. New tests cover a group whose leader is gone while a member runs, and a group /proc does not show. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0137eGmVJawiDxhgvZh2ypMR
This branch was successfully deployed
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.

Context
zitadel stopfailed with "Local Zitadel server did not stop" after the server had in fact exited.docker runwithout--init.Summary
kill(pid, 0), which is how the launcher checked whether it runs.apps/cli/src/lib/server/local/internal/binary-launcher.tsnow also reads the process's state from/proc/<pid>/stat.isPidRunning: a zombie is not running.isRunning: a process group runs only while it has a member that is not a zombie./proc(macOS, Windows) or where it cannot be read, the signal's answer stands as before.binary-launcher.test.ts(Linux only) leaves a process in its own group as a zombie under a parent that never collects it. It asserts that neither check counts that process as running, while its live parent still counts.Validation
vitest run tests/unit/lib/server/local/internal/binary-launcher.test.tsinapps/cli: 21 passed.binary-launcher.ts: the new test fails, the other 20 pass.pnpm run typecheckinapps/cli: clean.biome checkon the changed files: clean.Release notes / changeset
.changeset/cli-stop-unreaped-server.md(@zitadel/cli: patch):zitadel stopstops a local server inside a container started without an init. On Linux the CLI no longer counts a server that has exited as running while nothing has collected it.Notes
apps/cli/skills/zitadel-cli/SKILL.mddescribes nothing this changes:stopnow does what it already says.Generated by Claude Code