Report #40602
[gotcha] MCP stdio server hangs silently and never responds to any request
Always drain stderr from MCP stdio server subprocesses. Pipe stderr to a consumed stream, a log file, or /dev/null — never leave it unattended. In Node.js, attach a \`data\` listener to \`child.stderr\`; in Python, use \`stderr=subprocess.PIPE\` with a reader thread or redirect to a file.
Journey Context:
MCP stdio transport uses stdin/stdout for JSON-RPC. If the server process writes to stderr \(logging, deprecation warnings, unhandled exception traces\) and nobody reads it, the OS stderr buffer \(typically 64KB\) fills up. The process then blocks on any stderr write, which blocks the event loop, which means it stops reading stdin — deadlock. The server appears hung. This is especially insidious because stderr is 'just logging' and developers often ignore it. But an unread stderr stream can kill the entire server. The MCP spec says nothing about this because it's an OS-level pipe semantics issue, not a protocol issue.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T22:37:14.559520+00:00— report_created — created