fix(mcp): reap serve --mcp child when parent is SIGKILL'd (#286)
Add a PPID watchdog to the MCP server so a `codegraph serve --mcp` child terminates when its host (Claude Code, opencode, …) is force-killed — OOM killer, `kill -9`, container teardown — and the stdin close handlers don't fire. The child would otherwise linger indefinitely, holding inotify watches, file descriptors, and the SQLite WAL. Also propagates the host PID across the `--liftoff-only` re-exec (CODEGRAPH_HOST_PPID) so the watchdog reaps the orphan on the from-source path too, not just the bundled launcher. Poll interval is CODEGRAPH_PPID_POLL_MS (default 5000ms, 0 disables). Resolves #277. Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.7
parent
fd6a649518
commit
fb45959af7
@@ -9,6 +9,18 @@ and adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## [0.9.4] - 2026-05-22
|
||||
|
||||
### Fixed
|
||||
- **Orphaned `codegraph serve --mcp` processes after a parent SIGKILL.** When
|
||||
the MCP host (Claude Code, opencode, …) was force-killed — OOM killer, a
|
||||
`kill -9`, a container teardown — the child kept running indefinitely on
|
||||
Linux, holding inotify watches, file descriptors, and the SQLite WAL. The
|
||||
kernel doesn't propagate parent death to children, and the stdin
|
||||
`end`/`close` handlers we relied on don't always fire. The MCP server now
|
||||
polls `process.ppid` and shuts down the moment it changes from the value
|
||||
observed at startup; the poll interval is `CODEGRAPH_PPID_POLL_MS` (default
|
||||
`5000`, `0` disables). Resolves
|
||||
[#277](https://github.com/colbymchenry/codegraph/issues/277).
|
||||
|
||||
### Added
|
||||
- **Release archives now ship with a `SHA256SUMS` file**, and the npm launcher
|
||||
verifies the bundle it downloads against it — a mismatch aborts before
|
||||
|
||||
Reference in New Issue
Block a user