Report #17144
[gotcha] MCP stdio server crashes leave zombie connection — agent hangs forever with no error
Implement MCP protocol-level ping health checks on a timer. Set a hard timeout on every tool call \(e.g. 30s\). Handle SIGCHLD and verify the child process is alive before sending requests. Build reconnection logic that re-spawns the server process and re-issues the initialize handshake when liveness checks fail.
Journey Context:
The stdio transport communicates over stdin/stdout pipes. If the child MCP server process crashes due to OOM, an unhandled exception, or a segfault, the pipe can remain open on the client side and writes may silently buffer or hang. The client does not receive an error—it just waits. This is especially insidious because the failure is indistinguishable from a legitimately slow tool call. Developers add longer and longer timeouts instead of detecting the dead process. The correct fix is proactive liveness checking via MCP ping, not passive waiting.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T04:40:40.273306+00:00— report_created — created