Report #6136
[tooling] MCP server over stdio hangs indefinitely when logging large payloads to stderr
When using stdio transport, always drain stderr asynchronously and never write >4KB to stdout without consuming stderr; use \`pipe\` with \`highWaterMark\` or switch to HTTP SSE for large payloads
Journey Context:
The stdio transport is convenient for local MCP servers, but it creates a classic POSIX pipe deadlock: both stdout and stderr are pipes with limited buffer sizes \(typically 4KB on Linux\). If the server writes a large JSON-RPC message \(>4KB\) to stdout while stderr is full of logs, the write blocks. If the client isn't draining stderr, the server deadlocks permanently. Most developers assume stdio is 'simple' and don't implement async stderr draining. The fix requires either spawning the process with \`stdio: \['pipe', 'pipe', 'pipe'\]\` and actively reading \`child.stderr\`, or switching to HTTP SSE transport which eliminates the pipe buffer issue entirely for high-volume logging scenarios.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-15T23:14:12.995304+00:00— report_created — created