Commit c0f3c0e
Hermes Evolution
fix: catch BrokenPipeError in stdio stdout_writer
When the parent process (MCP client) closes the stdout pipe during
restart, kill, or graceful shutdown, stdout_writer() raises
BrokenPipeError at 'await stdout.flush()'. The existing handler only
catches anyio.ClosedResourceError, so the BrokenPipeError propagates
through anyio's TaskGroup as an unhandled ExceptionGroup, crashing the
entire MCP server process.
This is a common production scenario: any MCP client restart (config
reload, session reset, crash recovery) kills the server, requiring
manual cleanup of stale daemon locks and process restarts.
Fix: extend the except clause to also catch BrokenPipeError and
ConnectionResetError, treating them as graceful shutdown signals.
Tested in production with Hermes Agent (Nous Research) as the MCP
client and turbo-memory-mcp as the server.1 parent 2713b53 commit c0f3c0e
1 file changed
Lines changed: 7 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
71 | | - | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
72 | 78 | | |
73 | 79 | | |
74 | 80 | | |
| |||
0 commit comments