Commit d99d1b5
fix: add exception handling in StreamableHTTP shutdown
Update the shutdown logic to wrap terminate() calls in try-except blocks,
preventing one transport's termination error from affecting others.
Changes:
- Use logger.exception() instead of logger.debug() for better error visibility
- Simplify SSE writer closing by iterating values() directly instead of pop()
- Improve code comments to explain why graceful termination is needed
This follows the same approach as PR #2259 with minor improvements in
error handling.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>1 parent 20f8acb commit d99d1b5
File tree
2 files changed
+12
-8
lines changed- src/mcp/server
2 files changed
+12
-8
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
784 | 784 | | |
785 | 785 | | |
786 | 786 | | |
787 | | - | |
788 | | - | |
789 | | - | |
790 | | - | |
791 | | - | |
792 | | - | |
| 787 | + | |
| 788 | + | |
| 789 | + | |
| 790 | + | |
| 791 | + | |
793 | 792 | | |
794 | 793 | | |
795 | 794 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
130 | 130 | | |
131 | 131 | | |
132 | 132 | | |
133 | | - | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
134 | 136 | | |
135 | | - | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
136 | 141 | | |
137 | 142 | | |
138 | 143 | | |
| |||
0 commit comments