Report #7240
[gotcha] MCP server processes persist as zombies after client disconnect or crash
When using stdio transport, kill the entire process group \(not just the server PID\) on client shutdown. Use \`notifications/cancelled\` for graceful in-flight request cancellation. In the server, handle SIGTERM/SIGINT to clean up child processes. On the client side, use process-group-aware spawning \(e.g., \`detached: false\` in Node.js, or kill the process group with \`process.kill\(-pid\)\`\).
Journey Context:
The stdio transport launches the MCP server as a child process. If the client crashes or disconnects without graceful shutdown, the server process becomes a zombie. Worse, if the server itself spawns child processes \(e.g., running shell commands via bash tools\), those survive the parent server's death. Killing just the direct child PID leaves orphans that hold file descriptors and ports. The fix requires understanding Unix process groups, which most MCP client implementations skip.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T02:12:22.096717+00:00— report_created — created