Commit db34445
committed
fix(mcp): Bound fast-exit server close on stdio disconnect
When the MCP parent process exits abruptly with in-flight requests, shutdown can
block indefinitely waiting for server.close(). This keeps npm exec wrapper
processes alive and allows the child node process to climb in RSS.
Add a transport-disconnect fast-exit path that detaches lifecycle handlers,
races server.close() against a short timeout, and then exits immediately.
This preserves normal shutdown behavior for other reasons and keeps Sentry
enabled.
Also add focused unit tests for the bounded close helper outcomes.
Fixes #2731 parent c3d78ca commit db34445
4 files changed
Lines changed: 269 additions & 86 deletions
File tree
- src/server
- __tests__
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
76 | 76 | | |
77 | 77 | | |
78 | 78 | | |
79 | | - | |
| 79 | + | |
80 | 80 | | |
81 | 81 | | |
82 | 82 | | |
| |||
0 commit comments