René's URL Explorer Experiment


Title: [v1.x] Deflake the child process cleanup tests by maxisbey · Pull Request #2839 · modelcontextprotocol/python-sdk · GitHub

Open Graph Title: [v1.x] Deflake the child process cleanup tests by maxisbey · Pull Request #2839 · modelcontextprotocol/python-sdk

X Title: [v1.x] Deflake the child process cleanup tests by maxisbey · Pull Request #2839 · modelcontextprotocol/python-sdk

Description: Deflakes tests/client/test_stdio.py::TestChildProcessCleanup, the most frequent flake on v1.x CI (Windows legs). Tests-only; nothing under src/ is touched. Motivation and Context These three tests have two independent failure modes, both confirmed from CI failure logs and reproduced under load on 2-core Windows runners: Startup race (the dominant mode): the tests gave the spawned parent 0.5s to boot and the child a 0.3s window to demonstrate writing, using fixed anyio.sleep() calls. Two cold Python interpreter starts on a loaded 2-core runner routinely exceed that, and the test fails with assert 0 > 0 before the cleanup logic under test ever runs. Cross-test GC collateral: the tests kill the process tree but never reap or close the process object. The subprocess transports survive past the per-test event loop, become garbage, and get collected during whatever test runs next on that worker. On Windows the "unclosed transport" warning then dies inside the transport's __repr__ (ValueError: I/O operation on closed pipe), and filterwarnings = ["error"] fails that innocent test. This also explains failures previously observed in unrelated tests that happened to share a worker with these. Measured on 2-core Windows runners with three CPU-load processes (100 repetitions per arm per Python version, deliberately harsher than real CI): Arm 3.10 3.13 Failure modes stock tests 11/100 2/100 11 startup race, 2 GC collateral polling fix only 4/100 2/100 0 startup race, 6 GC collateral polling + disposal (this PR) 0/100 0/100 none What changed Polling instead of fixed sleeps (commit 1): startup and writing are verified by polling under anyio.fail_after(15); the post-kill "writing stopped" check polls until the file size is stable. Net faster than the old fixed sleeps on the green path. Stop detection hardening (commit 2): "stopped" requires three consecutive stable samples, so a starved-but-alive child cannot slip through a single quiet window; a tree_killed flag prevents the cleanup path from re-terminating an already-killed tree (the second Windows call would operate on a closed job handle). Reap and dispose (commit 3): after the tree is confirmed dead, the tests wait() the process and drain stdout to EOF before closing it, which is what allows asyncio to close the subprocess transport inside the test. No transports survive to be collected during a later test. The first two commits also reached the maxisbey/v1x-interaction-backport branch via #2837; the hunks are identical, so merging both into v1.x converges cleanly, with the third commit new here. How Has This Been Tested? Full v1.x gate (pytest + 100% line and branch coverage) green. Locally: 70+ repetitions of the class including runs under full-core CPU load, cross-test GC probes (-n 0 with a follow-on test file) clean, and zero warning output in any run. The load-rig confirmation run for the final arm completed: 0 failures in 100 repetitions on each of Python 3.10 and 3.13. Breaking Changes None. Tests-only. Types of changes Bug fix (non-breaking change which fixes an issue) New feature (non-breaking change which adds functionality) Breaking change (fix or feature that would cause existing functionality to change) Documentation update Checklist I have read the MCP Documentation My code follows the repository's style guidelines New and existing tests pass locally I have added appropriate error handling I have added or updated documentation as needed AI Disclaimer

Open Graph Description: Deflakes tests/client/test_stdio.py::TestChildProcessCleanup, the most frequent flake on v1.x CI (Windows legs). Tests-only; nothing under src/ is touched. Motivation and Context These three tests ...

X Description: Deflakes tests/client/test_stdio.py::TestChildProcessCleanup, the most frequent flake on v1.x CI (Windows legs). Tests-only; nothing under src/ is touched. Motivation and Context These three tests ...

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

X: @github

direct link

Domain: github.com

route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:855ec588-9ae2-54e5-2a5d-abf8da8037d2
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-id82BE:214886:134094:1A41F3:6A5A5955
html-safe-noncedebca35faf4383f9da198354c0f7ca8b05d8b3f0366544978a07a2d977b773a7
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4MkJFOjIxNDg4NjoxMzQwOTQ6MUE0MUYzOjZBNUE1OTU1IiwidmlzaXRvcl9pZCI6IjM0Njc1Nzg1MzIwNzgyMTY1IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmacccb2c49a5bfced5585f40ff3c0d7b5089a7dd5a5055c5f441e9ed440d2091773
hovercard-subject-tagpull_request:3848893953
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///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/modelcontextprotocol/python-sdk/pull/2839/files
twitter:imagehttps://avatars.githubusercontent.com/u/224885523?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/224885523?s=400&v=4
og:image:altDeflakes tests/client/test_stdio.py::TestChildProcessCleanup, the most frequent flake on v1.x CI (Windows legs). Tests-only; nothing under src/ is touched. Motivation and Context These three tests ...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
None05b9ddf6a47d2dbe13944873a99f5fb4b83ba4871f9cb8a8e256793a63ca9687
turbo-cache-controlno-preview
diff-viewunified
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-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
releasef8d29d1bd03dda2dd14b3f80b8bc27e1111f43bd
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/modelcontextprotocol/python-sdk/pull/2839/files#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmodelcontextprotocol%2Fpython-sdk%2Fpull%2F2839%2Ffiles
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%2F2839%2Ffiles
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%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=modelcontextprotocol%2Fpython-sdk
Reloadhttps://github.com/modelcontextprotocol/python-sdk/pull/2839/files
Reloadhttps://github.com/modelcontextprotocol/python-sdk/pull/2839/files
Reloadhttps://github.com/modelcontextprotocol/python-sdk/pull/2839/files
Please reload this pagehttps://github.com/modelcontextprotocol/python-sdk/pull/2839/files
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 256 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
Sign up for GitHub https://github.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://github.com/login?return_to=%2Fmodelcontextprotocol%2Fpython-sdk%2Fissues%2Fnew%2Fchoose
maxisbeyhttps://github.com/maxisbey
v1.xhttps://github.com/modelcontextprotocol/python-sdk/tree/v1.x
maxisbey/v1x-stdio-cleanup-deflakehttps://github.com/modelcontextprotocol/python-sdk/tree/maxisbey/v1x-stdio-cleanup-deflake
Conversation 0 https://github.com/modelcontextprotocol/python-sdk/pull/2839
Commits 3 https://github.com/modelcontextprotocol/python-sdk/pull/2839/commits
Checks 25 https://github.com/modelcontextprotocol/python-sdk/pull/2839/checks
Files changed 1 https://github.com/modelcontextprotocol/python-sdk/pull/2839/files
[v1.x] Deflake the child process cleanup tests https://github.com/modelcontextprotocol/python-sdk/pull/2839/files#top
Show all changes 3 commits https://github.com/modelcontextprotocol/python-sdk/pull/2839/files
c650a25 Deflake child process cleanup tests with polling instead of fixed sleeps maxisbey Jun 11, 2026 https://github.com/modelcontextprotocol/python-sdk/pull/2839/commits/c650a25c3cf65ebf81c8622f67752f50f0819b3c
8fe1f69 Harden stop detection and avoid redundant tree termination in cleanup… maxisbey Jun 11, 2026 https://github.com/modelcontextprotocol/python-sdk/pull/2839/commits/8fe1f69f8c09070f0a616b0e3f1a55346dda6507
903cc56 Reap and close spawned processes inside the child cleanup tests maxisbey Jun 11, 2026 https://github.com/modelcontextprotocol/python-sdk/pull/2839/commits/903cc561c4c77ef5035d8f389881d31e6b34bfbf
Clear filters https://github.com/modelcontextprotocol/python-sdk/pull/2839/files
Please reload this pagehttps://github.com/modelcontextprotocol/python-sdk/pull/2839/files
Please reload this pagehttps://github.com/modelcontextprotocol/python-sdk/pull/2839/files
Please reload this pagehttps://github.com/modelcontextprotocol/python-sdk/pull/2839/files
Please reload this pagehttps://github.com/modelcontextprotocol/python-sdk/pull/2839/files
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.