Title: Client requests hang forever if server dies · Issue #332 · modelcontextprotocol/python-sdk · GitHub
Open Graph Title: Client requests hang forever if server dies · Issue #332 · modelcontextprotocol/python-sdk
X Title: Client requests hang forever if server dies · Issue #332 · modelcontextprotocol/python-sdk
Description: Describe the bug If the stdio streams close before responding to a request (i.e. the server dies), the pending request waits forever (or for the read timeout) instead of erroring. To Reproduce Steps to reproduce the behavior: await sessi...
Open Graph Description: Describe the bug If the stdio streams close before responding to a request (i.e. the server dies), the pending request waits forever (or for the read timeout) instead of erroring. To Reproduce Step...
X Description: Describe the bug If the stdio streams close before responding to a request (i.e. the server dies), the pending request waits forever (or for the read timeout) instead of erroring. To Reproduce Step...
Opengraph URL: https://github.com/modelcontextprotocol/python-sdk/issues/332
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Client requests hang forever if server dies","articleBody":"**Describe the bug**\nIf the stdio streams close before responding to a request (i.e. the server dies), the pending request waits forever (or for the read timeout) instead of erroring.\n\n**To Reproduce**\nSteps to reproduce the behavior:\n1. `await session.initialize()` or some other request\n2. in the server request handler, exit instead of responding to the request\n3. on the client, the `await` never resolves so the client hangs indefinitely\n\n**Expected behavior**\nThe typescript SDK makes the pending requests return a `-32000` \"Connection closed\" in this case\n\nhttps://github.com/modelcontextprotocol/typescript-sdk/blob/0fa2397174eba309b54575294d56754c52b13a65/src/shared/protocol.ts#L260-L263\n","author":{"url":"https://github.com/mroch","@type":"Person","name":"mroch"},"datePublished":"2025-03-20T14:05:49.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":3},"url":"https://github.com/332/python-sdk/issues/332"}
| 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:de424b1b-4f2a-ef91-fbce-0e1b9665901d |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | CE76:1FC98B:17A3246:1F946B7:6A5BAE98 |
| html-safe-nonce | 056f2a7cf34bb50f778d599670b06d64add3e3307e839759c871d941c171d896 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDRTc2OjFGQzk4QjoxN0EzMjQ2OjFGOTQ2Qjc6NkE1QkFFOTgiLCJ2aXNpdG9yX2lkIjoiNDg4NTAxNDQ2NjE2NDE0MTcyMSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 810b4fad0fde90dbe755ae1c17bda761bb8e43b09a174cafc1f7cf2aaf42251a |
| hovercard-subject-tag | issue:2935621555 |
| 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/332/issue_layout |
| twitter:image | https://opengraph.githubassets.com/898f030fe9bc31e51a5212636b04f577d98aa90114a719faaf86e051b7043dce/modelcontextprotocol/python-sdk/issues/332 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/898f030fe9bc31e51a5212636b04f577d98aa90114a719faaf86e051b7043dce/modelcontextprotocol/python-sdk/issues/332 |
| og:image:alt | Describe the bug If the stdio streams close before responding to a request (i.e. the server dies), the pending request waits forever (or for the read timeout) instead of erroring. To Reproduce Step... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | mroch |
| hostname | github.com |
| expected-hostname | github.com |
| None | 5290d7e14309ad1e76106a9c4237bd1041517e83ea182c8ab756752cb0c6940b |
| 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 | 9c975978430e9ad293956f2bbdaf153b1bd84a99 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width