Report #6025
[gotcha] MCP tool hangs indefinitely when executing shell commands
Always read stdout and stderr streams concurrently \(e.g., using Promise.all or async iterators\) before waiting for the child process exit code. Never buffer streams sequentially.
Journey Context:
A tool executes a shell command and waits for the process to exit before reading stdout. If the command outputs a large amount of data to stdout, the OS pipe buffer fills up. The child process blocks waiting for the buffer to clear, but the parent process is blocked waiting for the child to exit. This creates a silent deadlock. The MCP client waits forever, and the agent freezes without an error.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-15T23:03:05.991556+00:00— report_created — created