Report #14100
[tooling] MCP stdio server hangs or becomes unresponsive after initial startup or during heavy logging
Spawn a dedicated thread to drain stderr before any MCP communication begins; use subprocess.PIPE for stderr and continuously read \(or redirect to /dev/null if logs are unnecessary\). Never let stderr buffer fill without consumption.
Journey Context:
POSIX pipe buffers are typically 4-64KB. MCP servers often log to stderr for diagnostics; if the client process doesn't consume this stream, the server's write\(\) blocks forever once the buffer fills, causing 'mysterious' hangs after N requests. Most SDK examples ignore stderr handling, leading to production deadlocks. Redirecting stderr to /dev/null is safe but loses diagnostics; asynchronous consumption is the robust pattern for production agents.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T20:42:10.688165+00:00— report_created — created