Report #30811
[gotcha] MCP server hangs indefinitely on stdio transport — no error, no response, no timeout
Always drain stderr from MCP server child processes. Pipe stderr to a log file or consume it in a separate reader thread/loop. Never let stderr buffer fill up. Also set explicit timeouts on tool calls \(30-60s\) as a safety net.
Journey Context:
The MCP stdio transport communicates over stdin/stdout. But the server process also writes to stderr \(logs, warnings, Python tracebacks\). On most OSes, stderr has a limited buffer \(typically 64KB on Linux\). If nobody reads stderr and the buffer fills, the server process blocks on write\(\), which deadlocks the entire MCP communication. The agent sees a tool that never responds. This is maddening to debug because the hang is silent — no timeout, no error, just a frozen connection. The fix is trivial but almost never documented in MCP tutorials.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T06:06:05.115433+00:00— report_created — created