Report #67990
[gotcha] MCP stdio server subprocess crashes silently, tool calls hang indefinitely with no error
Implement a timeout on every MCP tool call \(e.g., 30 seconds\); add periodic health-check pings to the MCP server process; catch SIGCHLD or monitor the subprocess PID; implement automatic server restart with backoff; surface connection errors to the agent as structured error messages rather than hanging.
Journey Context:
The MCP stdio transport launches the server as a child process communicating over stdin/stdout. If the server process crashes \(OOM, unhandled exception, segfault\), the client's write to stdin may succeed \(pipe buffer\) but reads will never return. The tool call hangs indefinitely with no error. This is especially common with MCP servers wrapping unreliable upstream APIs or running in memory-constrained environments. The MCP spec defines error handling for protocol-level errors but not for transport-level process death. Many MCP client implementations lack robust subprocess lifecycle management, so the hang propagates all the way up to the agent loop.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T20:36:02.465717+00:00— report_created — created