Title: Productive SSE reconnects accumulate stack frames and eventually fail · Issue #3791 · modelcontextprotocol/python-sdk · GitHub
Open Graph Title: Productive SSE reconnects accumulate stack frames and eventually fail · Issue #3791 · modelcontextprotocol/python-sdk
X Title: Productive SSE reconnects accumulate stack frames and eventually fail · Issue #3791 · modelcontextprotocol/python-sdk
Description: Problem Repeated productive SSE resumptions eventually fail because _handle_reconnection() recursively awaits itself. I reproduced this on current main at d7845c07, using an in-memory HTTP transport. Every connection delivers a notificat...
Open Graph Description: Problem Repeated productive SSE resumptions eventually fail because _handle_reconnection() recursively awaits itself. I reproduced this on current main at d7845c07, using an in-memory HTTP transpor...
X Description: Problem Repeated productive SSE resumptions eventually fail because _handle_reconnection() recursively awaits itself. I reproduced this on current main at d7845c07, using an in-memory HTTP transpor...
Opengraph URL: https://github.com/modelcontextprotocol/python-sdk/issues/3791
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Productive SSE reconnects accumulate stack frames and eventually fail","articleBody":"## Problem\n\nRepeated productive SSE resumptions eventually fail because `_handle_reconnection()` recursively awaits itself.\n\nI reproduced this on current main at `d7845c07`, using an in-memory HTTP transport. Every connection delivers a notification with a new event ID before closing; connection 1,500 supplies the final JSON-RPC response.\n\nOn macOS with Python 3.13:\n\n- Default recursion limit: 972 HTTP requests, 970 delivered notifications, then `CONNECTION_CLOSED` with “reconnection attempts were exhausted.”\n- Recursion limit raised to 3,000: all 1,500 requests complete, delivering 1,499 notifications and the final response.\n\nThe higher recursion limit is only a diagnostic experiment.\n\n## Expected behavior\n\nProductive resumptions should continue without accumulating Python stack frames or failing because of the interpreter recursion limit.\n\n## Scope\n\nThis differs from #2393’s no-progress retry-budget problem: every reconnect here delivers new data and advances the event ID.\n\nPR #3790 contains a proposed iterative implementation and a deterministic regression test. The test fails on unmodified code and passes with the patch, without changing the recursion limit. The proposed change preserves existing retry accounting.\n\nThe reproduction uses a synthetic peer; I have not verified this failure in a production deployment.\n\nWould an iterative implementation preserving the current retry semantics be an acceptable scope for this issue?\n\nAI assistance was used for investigation and implementation. I reproduced the behavior and ran the transport tests and static checks locally.","author":{"url":"https://github.com/namtran1812","@type":"Person","name":"namtran1812"},"datePublished":"2026-10-31T17:09:54Z","url":"https://github.com/modelcontextprotocol/python-sdk/issues/3791"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:9245a207-7dcd-7c97-4dcc-5487c78ea0b3 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E4F6:928E2:649113:885533:6B00D661 |
| html-safe-nonce | 8581bfc2ee5dfa8d31242d9399eccf04ef7d777cc76fb0dd73086cc601b356b0 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFNEY2OjkyOEUyOjY0OTExMzo4ODU1MzM6NkIwMEQ2NjEiLCJ2aXNpdG9yX2lkIjoiMzk0NzE4NjQ4MjgyNDkyNjgxNyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 8b998cef4dbd28b94ba001d9c7177551a5d5322460f3f654da93a81caf643f09 |
| hovercard-subject-tag | issue:6137565082 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/modelcontextprotocol/python-sdk/3791/issue_layout |
| twitter:image | https://opengraph.githubassets.com/09768a980f5ade0f2603c7eb05515034991bd9389543cc438c8346cf9b91bc84/modelcontextprotocol/python-sdk/issues/3791 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/09768a980f5ade0f2603c7eb05515034991bd9389543cc438c8346cf9b91bc84/modelcontextprotocol/python-sdk/issues/3791 |
| og:image:alt | Problem Repeated productive SSE resumptions eventually fail because _handle_reconnection() recursively awaits itself. I reproduced this on current main at d7845c07, using an in-memory HTTP transpor... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | namtran1812 |
| hostname | github.com |
| expected-hostname | github.com |
| None | a481f62a1e04c9b9bdcb5628230682c66d59006f5b13b080f79cba84a176905b |
| turbo-cache-control | no-preview |
| go-import | github.com/modelcontextprotocol/python-sdk git https://github.com/modelcontextprotocol/python-sdk.git |
| octolytics-dimension-user_id | 182288589 |
| octolytics-dimension-user_login | modelcontextprotocol |
| octolytics-dimension-repository_id | 862584018 |
| octolytics-dimension-repository_nwo | modelcontextprotocol/python-sdk |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 862584018 |
| octolytics-dimension-repository_network_root_nwo | modelcontextprotocol/python-sdk |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 84c8c5cc25e2fb7f2308428458538436baecc6d2 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width