René's URL Explorer Experiment


Title: fix: cleanup resources properly on `BaseSession::_receive_loop` cleanup by challenger71498 · Pull Request #1817 · modelcontextprotocol/python-sdk · GitHub

Open Graph Title: fix: cleanup resources properly on `BaseSession::_receive_loop` cleanup by challenger71498 · Pull Request #1817 · modelcontextprotocol/python-sdk

X Title: fix: cleanup resources properly on `BaseSession::_receive_loop` cleanup by challenger71498 · Pull Request #1817 · modelcontextprotocol/python-sdk

Description: This PR fixes Session cleanup is being failed, caused by task cancellation via __aexit__ not handled properly. Motivation and Context Session cleanups the receive streams via finally clause of Base...

Open Graph Description: This PR fixes Session cleanup is being failed, caused by task cancellation via __aexit__ not handled properly. Motivation and Context Session cleanups the receive streams via finally clause of Base...

X Description: This PR fixes Session cleanup is being failed, caused by task cancellation via __aexit__ not handled properly. Motivation and Context Session cleanups the receive streams via finally clause of Base...

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

X: @github

direct link

Domain: patch-diff.githubusercontent.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:98e2b302-203e-95a8-a5ef-8adbbb117865
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idAED4:2445E2:55263C7:728DFA1:696E158F
html-safe-nonceb95856adbb63d16266591fe2b4d7cd9cee6700aeb77a3ab38322ef824b5ea78d
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBRUQ0OjI0NDVFMjo1NTI2M0M3OjcyOERGQTE6Njk2RTE1OEYiLCJ2aXNpdG9yX2lkIjoiNDMwNjI1NDI2NTY2NDI3OTk1MSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac201af19eca32ae870337b7bdc290419b6840c925c75d657d9317cab28a2d1835
hovercard-subject-tagpull_request:3130558117
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/1817/pull_request_layout
twitter:imagehttps://opengraph.githubassets.com/451d55b4d71ea6596dcf3bf2e6ddc7e8444b0be52f4acb98032fea6bcf2fbef9/modelcontextprotocol/python-sdk/pull/1817
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/451d55b4d71ea6596dcf3bf2e6ddc7e8444b0be52f4acb98032fea6bcf2fbef9/modelcontextprotocol/python-sdk/pull/1817
og:image:altThis PR fixes Session cleanup is being failed, caused by task cancellation via __aexit__ not handled properly. Motivation and Context Session cleanups the receive streams via finally clause of Base...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamechallenger71498
hostnamegithub.com
expected-hostnamegithub.com
None1a7d6d739bf034e67486b9f97a31887ca30302b72a0acac49b6bcddff34356d7
turbo-cache-controlno-preview
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
release87d7872ec7094ed247923539669aabda9230966f
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://patch-diff.githubusercontent.com/modelcontextprotocol/python-sdk/pull/1817#start-of-content
https://patch-diff.githubusercontent.com/
Sign in https://patch-diff.githubusercontent.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmodelcontextprotocol%2Fpython-sdk%2Fpull%2F1817
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub SparkBuild and deploy intelligent appshttps://github.com/features/spark
GitHub ModelsManage and compare promptshttps://github.com/features/models
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
GitHub SponsorsFund open source developershttps://github.com/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/accelerator
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/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://patch-diff.githubusercontent.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmodelcontextprotocol%2Fpython-sdk%2Fpull%2F1817
Sign up https://patch-diff.githubusercontent.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://patch-diff.githubusercontent.com/modelcontextprotocol/python-sdk/pull/1817
Reloadhttps://patch-diff.githubusercontent.com/modelcontextprotocol/python-sdk/pull/1817
Reloadhttps://patch-diff.githubusercontent.com/modelcontextprotocol/python-sdk/pull/1817
modelcontextprotocol https://patch-diff.githubusercontent.com/modelcontextprotocol
python-sdkhttps://patch-diff.githubusercontent.com/modelcontextprotocol/python-sdk
Notifications https://patch-diff.githubusercontent.com/login?return_to=%2Fmodelcontextprotocol%2Fpython-sdk
Fork 3k https://patch-diff.githubusercontent.com/login?return_to=%2Fmodelcontextprotocol%2Fpython-sdk
Star 21.2k https://patch-diff.githubusercontent.com/login?return_to=%2Fmodelcontextprotocol%2Fpython-sdk
Code https://patch-diff.githubusercontent.com/modelcontextprotocol/python-sdk
Issues 239 https://patch-diff.githubusercontent.com/modelcontextprotocol/python-sdk/issues
Pull requests 94 https://patch-diff.githubusercontent.com/modelcontextprotocol/python-sdk/pulls
Actions https://patch-diff.githubusercontent.com/modelcontextprotocol/python-sdk/actions
Projects 0 https://patch-diff.githubusercontent.com/modelcontextprotocol/python-sdk/projects
Security Uh oh! There was an error while loading. Please reload this page. https://patch-diff.githubusercontent.com/modelcontextprotocol/python-sdk/security
Please reload this pagehttps://patch-diff.githubusercontent.com/modelcontextprotocol/python-sdk/pull/1817
Insights https://patch-diff.githubusercontent.com/modelcontextprotocol/python-sdk/pulse
Code https://patch-diff.githubusercontent.com/modelcontextprotocol/python-sdk
Issues https://patch-diff.githubusercontent.com/modelcontextprotocol/python-sdk/issues
Pull requests https://patch-diff.githubusercontent.com/modelcontextprotocol/python-sdk/pulls
Actions https://patch-diff.githubusercontent.com/modelcontextprotocol/python-sdk/actions
Projects https://patch-diff.githubusercontent.com/modelcontextprotocol/python-sdk/projects
Security https://patch-diff.githubusercontent.com/modelcontextprotocol/python-sdk/security
Insights https://patch-diff.githubusercontent.com/modelcontextprotocol/python-sdk/pulse
Sign up for GitHub https://patch-diff.githubusercontent.com/signup?return_to=%2Fmodelcontextprotocol%2Fpython-sdk%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://patch-diff.githubusercontent.com/login?return_to=%2Fmodelcontextprotocol%2Fpython-sdk%2Fissues%2Fnew%2Fchoose
Jump to bottomhttps://patch-diff.githubusercontent.com/modelcontextprotocol/python-sdk/pull/1817#issue-comment-box
challenger71498https://patch-diff.githubusercontent.com/challenger71498
modelcontextprotocol:mainhttps://patch-diff.githubusercontent.com/modelcontextprotocol/python-sdk/tree/main
challenger71498:fix/session-cleanuphttps://patch-diff.githubusercontent.com/challenger71498/python-sdk/tree/fix/session-cleanup
fix: cleanup resources properly on BaseSession::_receive_loop cleanup https://patch-diff.githubusercontent.com/modelcontextprotocol/python-sdk/pull/1817#top
challenger71498https://patch-diff.githubusercontent.com/challenger71498
modelcontextprotocol:mainhttps://patch-diff.githubusercontent.com/modelcontextprotocol/python-sdk/tree/main
challenger71498:fix/session-cleanuphttps://patch-diff.githubusercontent.com/challenger71498/python-sdk/tree/fix/session-cleanup
Conversation 0 https://patch-diff.githubusercontent.com/modelcontextprotocol/python-sdk/pull/1817
Commits 4 https://patch-diff.githubusercontent.com/modelcontextprotocol/python-sdk/pull/1817/commits
Checks 22 https://patch-diff.githubusercontent.com/modelcontextprotocol/python-sdk/pull/1817/checks
Files changed 2 https://patch-diff.githubusercontent.com/modelcontextprotocol/python-sdk/pull/1817/files
https://github.co/hiddenchars
https://patch-diff.githubusercontent.com/modelcontextprotocol/python-sdk/pull/{{ revealButtonHref }}
https://patch-diff.githubusercontent.com/challenger71498
challenger71498https://patch-diff.githubusercontent.com/challenger71498
Dec 26, 2025https://patch-diff.githubusercontent.com/modelcontextprotocol/python-sdk/pull/1817#issue-3762706854
Please reload this pagehttps://patch-diff.githubusercontent.com/modelcontextprotocol/python-sdk/pull/1817
MCP Documentationhttps://modelcontextprotocol.io
client's read_stream_writer open after SSE disconnection hanging .receive() #1811https://github.com/modelcontextprotocol/python-sdk/issues/1811
cannot get response from await session.call_tool() #262https://github.com/modelcontextprotocol/python-sdk/issues/262
Please reload this pagehttps://patch-diff.githubusercontent.com/modelcontextprotocol/python-sdk/pull/1817
challenger71498https://patch-diff.githubusercontent.com/challenger71498
December 26, 2025 12:44https://patch-diff.githubusercontent.com/modelcontextprotocol/python-sdk/pull/1817#commits-pushed-5809089
https://patch-diff.githubusercontent.com/challenger71498
test: add case for cleanup on __aexit__https://patch-diff.githubusercontent.com/modelcontextprotocol/python-sdk/pull/1817/commits/5809089d65eac58ec2a5384626570fdf920780cc
5809089https://patch-diff.githubusercontent.com/modelcontextprotocol/python-sdk/pull/1817/commits/5809089d65eac58ec2a5384626570fdf920780cc
https://patch-diff.githubusercontent.com/challenger71498
fix: guard cleanup logic with shield=Truehttps://patch-diff.githubusercontent.com/modelcontextprotocol/python-sdk/pull/1817/commits/606e4c8b3690f96e425e5d9e9a082257399a2054
606e4c8https://patch-diff.githubusercontent.com/modelcontextprotocol/python-sdk/pull/1817/commits/606e4c8b3690f96e425e5d9e9a082257399a2054
https://patch-diff.githubusercontent.com/challenger71498
feat: add a flag on cleanup to protect change on dicthttps://patch-diff.githubusercontent.com/modelcontextprotocol/python-sdk/pull/1817/commits/7534b370cc632c5a822cd4f528c468b4567f3b4d
7534b37https://patch-diff.githubusercontent.com/modelcontextprotocol/python-sdk/pull/1817/commits/7534b370cc632c5a822cd4f528c468b4567f3b4d
Possible ressource leak / race condition in streamable_http_client #1805 https://patch-diff.githubusercontent.com/modelcontextprotocol/python-sdk/issues/1805
cannot get response from await session.call_tool() #262 https://patch-diff.githubusercontent.com/modelcontextprotocol/python-sdk/issues/262
feat: start and close ClientSession in a single task in McpSessionManager google/adk-python#4025 https://patch-diff.githubusercontent.com/google/adk-python/pull/4025
https://patch-diff.githubusercontent.com/maxisbey
maxisbeyhttps://patch-diff.githubusercontent.com/maxisbey
bug https://patch-diff.githubusercontent.com/modelcontextprotocol/python-sdk/issues?q=state%3Aopen%20label%3Abug
P1 https://patch-diff.githubusercontent.com/modelcontextprotocol/python-sdk/issues?q=state%3Aopen%20label%3AP1
Dec 31, 2025https://patch-diff.githubusercontent.com/modelcontextprotocol/python-sdk/pull/1817#event-21811016971
https://patch-diff.githubusercontent.com/challenger71498
Merge branch 'main' into fix/session-cleanuphttps://patch-diff.githubusercontent.com/modelcontextprotocol/python-sdk/pull/1817/commits/26117da277702331c095136af1bba9994ea27839
26117dahttps://patch-diff.githubusercontent.com/modelcontextprotocol/python-sdk/pull/1817/commits/26117da277702331c095136af1bba9994ea27839
copybara-servicehttps://patch-diff.githubusercontent.com/apps/copybara-service
Jan 15, 2026 https://patch-diff.githubusercontent.com/modelcontextprotocol/python-sdk/pull/1817#ref-commit-cce430d
https://patch-diff.githubusercontent.com/wukath
https://patch-diff.githubusercontent.com/copybara-github
feat: start and close ClientSession in a single task in McpSessionMan…https://patch-diff.githubusercontent.com/google/adk-python/commit/cce430da799766686e65f6cae02ba64e916d5c8a
cce430dhttps://patch-diff.githubusercontent.com/google/adk-python/commit/cce430da799766686e65f6cae02ba64e916d5c8a
#4025https://github.com/google/adk-python/pull/4025
https://github.com/google/adk-python/blob/main/CONTRIBUTING.mdhttps://github.com/google/adk-python/blob/main/CONTRIBUTING.md
#3950https://github.com/google/adk-python/issues/3950
#3731https://github.com/google/adk-python/issues/3731
#3708https://github.com/google/adk-python/issues/3708
https://github.com/modelcontextprotocol/python-sdkhttps://github.com/modelcontextprotocol/python-sdk
modelcontextprotocol/python-sdk#262https://github.com/modelcontextprotocol/python-sdk/issues/262
https://github.com/google/adk-python/blob/main/CONTRIBUTING.mdhttps://github.com/google/adk-python/blob/main/CONTRIBUTING.md
modelcontextprotocol/python-sdk#1817https://github.com/modelcontextprotocol/python-sdk/pull/1817
#4025https://github.com/google/adk-python/pull/4025
f7f7cd0https://github.com/google/adk-python/commit/f7f7cd0c9c96840361c30499d08c33a189f57d86
Sign up for freehttps://patch-diff.githubusercontent.com/join?source=comment-repo
Sign in to commenthttps://patch-diff.githubusercontent.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmodelcontextprotocol%2Fpython-sdk%2Fpull%2F1817
bug https://patch-diff.githubusercontent.com/modelcontextprotocol/python-sdk/issues?q=state%3Aopen%20label%3Abug
P1 https://patch-diff.githubusercontent.com/modelcontextprotocol/python-sdk/issues?q=state%3Aopen%20label%3AP1
Please reload this pagehttps://patch-diff.githubusercontent.com/modelcontextprotocol/python-sdk/pull/1817
https://patch-diff.githubusercontent.com/challenger71498
https://patch-diff.githubusercontent.com/maxisbey
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.