Commit e750b28
Charlie Tonneslan
fix: prevent stack overflow on concurrent transport close
When multiple MCP transport sessions close simultaneously (server
restart, network partition, mass disconnect), the onclose callbacks
can trigger recursive close operations that overflow the call stack.
The process stays alive but becomes completely unresponsive.
Added a _closing guard flag that prevents re-entrant close() calls.
Once close() is entered, subsequent calls return immediately.
Fixes #16991 parent ccb78f2 commit e750b28
2 files changed
Lines changed: 14 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
238 | 238 | | |
239 | 239 | | |
240 | 240 | | |
| 241 | + | |
241 | 242 | | |
242 | 243 | | |
243 | 244 | | |
| |||
887 | 888 | | |
888 | 889 | | |
889 | 890 | | |
| 891 | + | |
| 892 | + | |
| 893 | + | |
| 894 | + | |
| 895 | + | |
| 896 | + | |
| 897 | + | |
| 898 | + | |
890 | 899 | | |
891 | 900 | | |
892 | 901 | | |
| |||
0 commit comments