Report #90144
[tooling] MCP server hangs indefinitely after tool execution or produces partial output
Spawn MCP servers with stdio: \['pipe', 'pipe', 'pipe'\] and actively drain the stderr stream; never use 'inherit' or 'ignore' for stderr. In Node.js, attach a data handler to child.stderr immediately after spawning to prevent OS pipe buffer blocking.
Journey Context:
The MCP stdio transport multiplexes JSON-RPC messages over stdout. If the server writes to stderr \(e.g., via console.error or logging libraries\) and the parent process isn't consuming that pipe, the server blocks once the 64KB OS pipe buffer fills. This manifests as a mysterious hang after a tool runs successfully but tries to log. Common mistakes: spawning with stdio: 'inherit' \(which shares the parent's stderr, causing interleaved JSON corruption\) or piping only stdin/stdout while ignoring stderr. The fix ensures backpressure is handled by draining stderr independently of stdout.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T09:54:15.108276+00:00— report_created — created