René's URL Explorer Experiment


Title: fix: cancel in-flight handlers when transport closes in server.run() by maxisbey · Pull Request #2306 · modelcontextprotocol/python-sdk · GitHub

Open Graph Title: fix: cancel in-flight handlers when transport closes in server.run() by maxisbey · Pull Request #2306 · modelcontextprotocol/python-sdk

X Title: fix: cancel in-flight handlers when transport closes in server.run() by maxisbey · Pull Request #2306 · modelcontextprotocol/python-sdk

Description: The official Python SDK for Model Context Protocol servers and clients - fix: cancel in-flight handlers when transport closes in server.run() by maxisbey · Pull Request #2306 · modelcontextprotocol/python-sdk

Open Graph Description: When the transport closes mid-request, server.run() now cancels in-flight handlers instead of waiting for them. Motivation and Context Discovered while investigating #2231. That issue's stated ...

X Description: When the transport closes mid-request, server.run() now cancels in-flight handlers instead of waiting for them. Motivation and Context Discovered while investigating #2231. That issue's sta...

Opengraph URL: https://github.com/modelcontextprotocol/python-sdk/pull/2306

X: @github

direct link

Domain: github.com

route-pattern/_view_fragments/voltron/pull_requests/show/:user_id/:repository/:id/pull_request_layout(.:format)
route-controllervoltron_pull_requests_fragments
route-actionpull_request_layout
fetch-noncev2:72c0f7fe-4b70-eacc-af57-2917a8f14118
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idDB18:131B09:195B86D:24235A9:6A5A3783
html-safe-nonceef1e93e562848d38513df5f5ef58eb5cf55e280616afaa5e1ce9e254e18e5ce7
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEQjE4OjEzMUIwOToxOTVCODZEOjI0MjM1QTk6NkE1QTM3ODMiLCJ2aXNpdG9yX2lkIjoiNzcxODY4NjE3OTg0NDU2ODk2MyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac20a76577e52e6723813ef4f568499adddb75ebada9ef6325ccb282e782e9270a
hovercard-subject-tagpull_request:3415641486
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/pull_requests_fragments/pull_request_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/voltron/pull_requests/show/modelcontextprotocol/python-sdk/2306/pull_request_layout
twitter:imagehttps://opengraph.githubassets.com/08834df1d02db6f01b85333a42fe4d0af6c6d7368284dd0343098219884bdcda/modelcontextprotocol/python-sdk/pull/2306
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/08834df1d02db6f01b85333a42fe4d0af6c6d7368284dd0343098219884bdcda/modelcontextprotocol/python-sdk/pull/2306
og:image:altWhen the transport closes mid-request, server.run() now cancels in-flight handlers instead of waiting for them. Motivation and Context Discovered while investigating #2231. That issue's stated ...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamemaxisbey
hostnamegithub.com
expected-hostnamegithub.com
None19c67ad7579d2401ff06e88a32ef45460fbb40fab3191c7f7582d5e166f326fc
turbo-cache-controlno-cache
go-importgithub.com/modelcontextprotocol/python-sdk git https://github.com/modelcontextprotocol/python-sdk.git
octolytics-dimension-user_id182288589
octolytics-dimension-user_loginmodelcontextprotocol
octolytics-dimension-repository_id862584018
octolytics-dimension-repository_nwomodelcontextprotocol/python-sdk
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id862584018
octolytics-dimension-repository_network_root_nwomodelcontextprotocol/python-sdk
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
releasee618485bff22dab2ef1ffb4e34e4e6626688df69
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/modelcontextprotocol/python-sdk/pull/2306#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmodelcontextprotocol%2Fpython-sdk%2Fpull%2F2306
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub Copilot appDirect agents from issue to mergehttps://github.com/features/ai/github-app
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
View all resourceshttps://github.com/resources
GitHub SponsorsFund open source developershttps://github.com/open-source/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/open-source/accelerator
GitHub Starshttps://stars.github.com
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmodelcontextprotocol%2Fpython-sdk%2Fpull%2F2306
Sign up https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fpull_requests_fragments%2Fpull_request_layout&source=header-repo&source_repo=modelcontextprotocol%2Fpython-sdk
Reloadhttps://github.com/modelcontextprotocol/python-sdk/pull/2306
Reloadhttps://github.com/modelcontextprotocol/python-sdk/pull/2306
Reloadhttps://github.com/modelcontextprotocol/python-sdk/pull/2306
Please reload this pagehttps://github.com/modelcontextprotocol/python-sdk/pull/2306
modelcontextprotocol https://github.com/modelcontextprotocol
python-sdkhttps://github.com/modelcontextprotocol/python-sdk
Notifications https://github.com/login?return_to=%2Fmodelcontextprotocol%2Fpython-sdk
Fork 3.7k https://github.com/login?return_to=%2Fmodelcontextprotocol%2Fpython-sdk
Star 23.6k https://github.com/login?return_to=%2Fmodelcontextprotocol%2Fpython-sdk
Code https://github.com/modelcontextprotocol/python-sdk
Issues 255 https://github.com/modelcontextprotocol/python-sdk/issues
Pull requests 303 https://github.com/modelcontextprotocol/python-sdk/pulls
Actions https://github.com/modelcontextprotocol/python-sdk/actions
Projects https://github.com/modelcontextprotocol/python-sdk/projects
Models https://github.com/modelcontextprotocol/python-sdk/models
Security and quality 6 https://github.com/modelcontextprotocol/python-sdk/security
Insights https://github.com/modelcontextprotocol/python-sdk/pulse
Code https://github.com/modelcontextprotocol/python-sdk
Issues https://github.com/modelcontextprotocol/python-sdk/issues
Pull requests https://github.com/modelcontextprotocol/python-sdk/pulls
Actions https://github.com/modelcontextprotocol/python-sdk/actions
Projects https://github.com/modelcontextprotocol/python-sdk/projects
Models https://github.com/modelcontextprotocol/python-sdk/models
Security and quality https://github.com/modelcontextprotocol/python-sdk/security
Insights https://github.com/modelcontextprotocol/python-sdk/pulse
maxisbeyhttps://github.com/maxisbey
mainhttps://github.com/modelcontextprotocol/python-sdk/tree/main
fix/cancel-in-flight-on-transport-closehttps://github.com/modelcontextprotocol/python-sdk/tree/fix/cancel-in-flight-on-transport-close
Conversationhttps://github.com/modelcontextprotocol/python-sdk/pull/2306
Commits4 (4)https://github.com/modelcontextprotocol/python-sdk/pull/2306/commits
Checkshttps://github.com/modelcontextprotocol/python-sdk/pull/2306/checks
Files changedhttps://github.com/modelcontextprotocol/python-sdk/pull/2306/files
fix: cancel in-flight handlers when transport closes in server.run()https://github.com/modelcontextprotocol/python-sdk/pull/2306#top
maxisbeyhttps://github.com/maxisbey
mainhttps://github.com/modelcontextprotocol/python-sdk/tree/main
fix/cancel-in-flight-on-transport-closehttps://github.com/modelcontextprotocol/python-sdk/tree/fix/cancel-in-flight-on-transport-close
https://github.com/maxisbey
maxisbeyhttps://github.com/maxisbey
Mar 18, 2026https://github.com/modelcontextprotocol/python-sdk/pull/2306#issue-4096089190
#2231https://github.com/modelcontextprotocol/python-sdk/issues/2231
server.run()'s task grouphttps://github.com/modelcontextprotocol/python-sdk/blob/ff50351f9e08b0a7dbbcade3813c48986b737b05/src/mcp/server/lowlevel/server.py#L389-L399
_receive_loop already closedhttps://github.com/modelcontextprotocol/python-sdk/blob/ff50351f9e08b0a7dbbcade3813c48986b737b05/src/mcp/shared/session.py#L334
#2257https://github.com/modelcontextprotocol/python-sdk/pull/2257
#1153https://github.com/modelcontextprotocol/python-sdk/pull/1153
#526https://github.com/modelcontextprotocol/python-sdk/issues/526
conn.go:167https://github.com/modelcontextprotocol/go-sdk/blob/a433a83/internal/jsonrpc2/conn.go#L166-L168
modelcontextprotocol/csharp-sdk#226https://github.com/modelcontextprotocol/csharp-sdk/pull/226
MCP Documentationhttps://modelcontextprotocol.io
Please reload this pagehttps://github.com/modelcontextprotocol/python-sdk/pull/2306
https://github.com/maxisbey
fix: cancel in-flight handlers when transport closes in server.run()https://github.com/modelcontextprotocol/python-sdk/pull/2306/commits/f638a9d3588e20d45516bf8fb475f416875416ce
f638a9dhttps://github.com/modelcontextprotocol/python-sdk/pull/2306/commits/f638a9d3588e20d45516bf8fb475f416875416ce
#1153https://github.com/modelcontextprotocol/python-sdk/pull/1153
#526https://github.com/modelcontextprotocol/python-sdk/issues/526
https://github.com/maxisbey
maxisbeyhttps://github.com/maxisbey
March 18, 2026 15:51https://github.com/modelcontextprotocol/python-sdk/pull/2306#event-23687396665
https://github.com/maxisbey
maxisbeyhttps://github.com/maxisbey
Kludexhttps://github.com/Kludex
March 18, 2026 15:51https://github.com/modelcontextprotocol/python-sdk/pull/2306#event-23687398496
https://github.com/apps/claude
claudehttps://github.com/apps/claude
Mar 18, 2026 https://github.com/modelcontextprotocol/python-sdk/pull/2306#pullrequestreview-3969092124
View reviewed changes https://github.com/modelcontextprotocol/python-sdk/pull/2306/files/f638a9d3588e20d45516bf8fb475f416875416ce
claudehttps://github.com/apps/claude
https://github.com/modelcontextprotocol/python-sdk/pull/2306#pullrequestreview-3969092124
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
Please reload this pagehttps://github.com/modelcontextprotocol/python-sdk/pull/2306
https://github.com/maxisbey
fix: handle transport close with pending server-to-client requestshttps://github.com/modelcontextprotocol/python-sdk/pull/2306/commits/36a974acd8d28969e9b2df8e9bbf6f8fea18d421
36a974ahttps://github.com/modelcontextprotocol/python-sdk/pull/2306/commits/36a974acd8d28969e9b2df8e9bbf6f8fea18d421
https://github.com/apps/claude
claudehttps://github.com/apps/claude
Mar 18, 2026 https://github.com/modelcontextprotocol/python-sdk/pull/2306#pullrequestreview-3969632455
View reviewed changes https://github.com/modelcontextprotocol/python-sdk/pull/2306/files/36a974acd8d28969e9b2df8e9bbf6f8fea18d421
src/mcp/server/lowlevel/server.pyhttps://github.com/modelcontextprotocol/python-sdk/pull/2306/files/36a974acd8d28969e9b2df8e9bbf6f8fea18d421#diff-b21bf5e21c058ccfddb404c209f2d4288e4f32b121111ffc9d466638631d13e4
Please reload this pagehttps://github.com/modelcontextprotocol/python-sdk/pull/2306
src/mcp/server/lowlevel/server.pyhttps://github.com/modelcontextprotocol/python-sdk/pull/2306/files/36a974acd8d28969e9b2df8e9bbf6f8fea18d421#diff-b21bf5e21c058ccfddb404c209f2d4288e4f32b121111ffc9d466638631d13e4
Please reload this pagehttps://github.com/modelcontextprotocol/python-sdk/pull/2306
maxisbeyhttps://github.com/maxisbey
March 18, 2026 18:09https://github.com/modelcontextprotocol/python-sdk/pull/2306#commits-pushed-e1d712d
https://github.com/maxisbey
refactor: unify respond() call after if/else to avoid 3.14 phantom tracehttps://github.com/modelcontextprotocol/python-sdk/pull/2306/commits/e1d712dd1902037ae5f1a37219b16541880e48bd
e1d712dhttps://github.com/modelcontextprotocol/python-sdk/pull/2306/commits/e1d712dd1902037ae5f1a37219b16541880e48bd
https://github.com/maxisbey
fix: also catch BrokenResourceError from respond() for SHTTP terminate()https://github.com/modelcontextprotocol/python-sdk/pull/2306/commits/328bb0b411119567ad9250eadc38893a3138868b
328bb0bhttps://github.com/modelcontextprotocol/python-sdk/pull/2306/commits/328bb0b411119567ad9250eadc38893a3138868b
https://github.com/maxisbey
maxisbeyhttps://github.com/maxisbey
felixweinbergerhttps://github.com/felixweinberger
March 20, 2026 11:57https://github.com/modelcontextprotocol/python-sdk/pull/2306#event-23750153470
https://github.com/felixweinberger
felixweinbergerhttps://github.com/felixweinberger
Mar 20, 2026 https://github.com/modelcontextprotocol/python-sdk/pull/2306#pullrequestreview-3981457063
View reviewed changes https://github.com/modelcontextprotocol/python-sdk/pull/2306/files/328bb0b411119567ad9250eadc38893a3138868b
https://github.com/maxisbey
maxisbeyhttps://github.com/maxisbey
92c693bhttps://github.com/modelcontextprotocol/python-sdk/commit/92c693bb730d059b2cc3836ccf0cdfe0720e9e18
Mar 20, 2026https://github.com/modelcontextprotocol/python-sdk/pull/2306#event-23752685557
Please reload this pagehttps://github.com/modelcontextprotocol/python-sdk/pull/2306
https://github.com/maxisbey
maxisbeyhttps://github.com/maxisbey
March 20, 2026 13:37https://github.com/modelcontextprotocol/python-sdk/pull/2306#event-23752686818
https://github.com/maxisbey
maxisbeyhttps://github.com/maxisbey
Mar 20, 2026 https://github.com/modelcontextprotocol/python-sdk/pull/2306#ref-issue-4033813323
Stdio transport: MCP server process survives parent death (stdin EOF not causing shutdown) #2231 https://github.com/modelcontextprotocol/python-sdk/issues/2231
https://github.com/owendevereaux
owendevereauxhttps://github.com/owendevereaux
Mar 22, 2026 https://github.com/modelcontextprotocol/python-sdk/pull/2306#ref-pullrequest-4117149733
[v1.x] fix: handle ClosedResourceError when transport closes mid-request #2334 https://github.com/modelcontextprotocol/python-sdk/pull/2334
fix: upgrade mcp SDK to v1.x branch to fix ClosedResourceError datagouv/datagouv-mcp#84 https://github.com/datagouv/datagouv-mcp/pull/84
MCP Out of Memory errors on production instances datagouv/datagouv-mcp#86 https://github.com/datagouv/datagouv-mcp/issues/86
https://github.com/bbarwik
bbarwikhttps://github.com/bbarwik
Apr 9, 2026 https://github.com/modelcontextprotocol/python-sdk/pull/2306#ref-issue-4234724647
Bug: AssertionError: Request already responded to — cancellation race in v1.27.0 #2416 https://github.com/modelcontextprotocol/python-sdk/issues/2416
https://github.com/maxisbey
maxisbeyhttps://github.com/maxisbey
May 18, 2026 https://github.com/modelcontextprotocol/python-sdk/pull/2306#ref-issue-4114933914
[Bug] Server crashes with anyio.ClosedResourceError when receiving raw invalid UTF-8 bytes #2328 https://github.com/modelcontextprotocol/python-sdk/issues/2328
https://github.com/apps/mcp-claude
mcp-claudehttps://github.com/apps/mcp-claude
Jun 1, 2026 https://github.com/modelcontextprotocol/python-sdk/pull/2306#ref-issue-4456573446
RequestResponder.__exit__ leaks CancelledError on cancelled request, killing the stdio receive loop #2610 https://github.com/modelcontextprotocol/python-sdk/issues/2610
https://github.com/maxisbey
maxisbeyhttps://github.com/maxisbey
Jun 12, 2026 https://github.com/modelcontextprotocol/python-sdk/pull/2306#ref-pullrequest-4642346713
[v2] ClientSession runs on JSONRPCDispatcher; BaseSession removed #2838 https://github.com/modelcontextprotocol/python-sdk/pull/2838
https://github.co/hiddenchars
https://github.com/modelcontextprotocol/python-sdk/pull/{{ revealButtonHref }}
Sign up for freehttps://github.com/join?source=comment-repo
Sign in to commenthttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmodelcontextprotocol%2Fpython-sdk%2Fpull%2F2306
https://github.com/apps/claude
claude[bot] https://github.com/apps/claude
https://github.com/modelcontextprotocol/python-sdk/pull/2306/files/36a974acd8d28969e9b2df8e9bbf6f8fea18d421
https://github.com/felixweinberger
felixweinberger https://github.com/felixweinberger
https://github.com/modelcontextprotocol/python-sdk/pull/2306/files/328bb0b411119567ad9250eadc38893a3138868b
https://github.com/Kludex
Kludex https://github.com/Kludex
Please reload this pagehttps://github.com/modelcontextprotocol/python-sdk/pull/2306
https://github.com/maxisbey
https://github.com/felixweinberger
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.