Report #94490
[gotcha] MCP server process crashes but the client doesn't notice — subsequent tool calls fail with confusing errors
Monitor the MCP server child process lifecycle explicitly. For stdio servers, attach listeners to the process 'exit' and 'error' events. After any tool call failure, check if the server process is still alive before retrying. Implement automatic server restart logic. Consider adding a lightweight health-check/ping tool to each server for proactive liveness detection.
Journey Context:
When an MCP server process crashes \(OOM kill, unhandled exception, segfault\), the stdio pipe closes. But the client may not check pipe status until the next tool call attempt. The error from the failed call is often generic — 'connection closed', 'write EPIPE', or 'Channel closed' — rather than 'server process exited with code 1.' This is especially confusing when the server crashes due to a previous tool call's side effect: the tool appears to succeed \(response was sent before crash\), but the server dies moments later, and the next unrelated tool call fails. Developers waste hours debugging the wrong tool call, adding logging to the surviving code, when the real issue is a dead process they didn't know about.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T17:11:11.286121+00:00— report_created — created