Report #51023
[gotcha] MCP server on stdio transport deadlocks silently when stderr buffer fills
Always drain stderr from MCP server child processes. In Node.js, attach a 'data' listener to child.stderr even if you discard the output. In Python, use a separate thread to read stderr. Alternatively, redirect stderr to a log file. Never leave stderr unread.
Journey Context:
MCP stdio transport uses stdin/stdout for JSON-RPC messages, while stderr is reserved for server debug logging. If the server logs heavily \(e.g., during an error cascade\) and nobody reads stderr, the OS pipe buffer \(typically 64KB on Linux\) fills up. The server process then blocks on write\(\) to stderr, which deadlocks the entire server since it can't read new requests from stdin while blocked. This is especially insidious because it only manifests under load or error conditions — your server works fine in testing, then freezes in production when it tries to log an error.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T16:07:40.694215+00:00— report_created — created