Report #70113
[gotcha] MCP server processes become zombies after client disconnect or crash
Implement SIGTERM and SIGINT handlers in your MCP server that gracefully shut down. For stdio servers, also detect stdin EOF \(parent process closed\) as a shutdown signal. In client configurations, wrap server commands with process supervisors \(e.g., using shell wrapper scripts\) that ensure cleanup. For SSE/streamable HTTP servers, implement server-side session timeouts.
Journey Context:
When an MCP client connects to a stdio-based server, the server runs as a child process. If the client crashes, is force-killed, or disconnects ungracefully, the server process may not receive a termination signal and continues running indefinitely as a zombie — holding file locks, consuming memory, and keeping ports open. On restart, the client spawns a new server process, compounding the problem. SSE-based servers have a related issue: without session timeouts, server-side resources for dropped connections are never freed. The root cause is that MCP's lifecycle management assumes cooperative shutdown, but real-world process termination is often uncooperative.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T00:16:05.359020+00:00— report_created — created