Title: Fix flaky tests in TestChildProcessCleanup (test_stdio.py) · Issue #1775 · modelcontextprotocol/python-sdk · GitHub
Open Graph Title: Fix flaky tests in TestChildProcessCleanup (test_stdio.py) · Issue #1775 · modelcontextprotocol/python-sdk
X Title: Fix flaky tests in TestChildProcessCleanup (test_stdio.py) · Issue #1775 · modelcontextprotocol/python-sdk
Description: Initial Checks I confirm that I'm using the latest version of MCP Python SDK I confirm that I searched for my issue in https://github.com/modelcontextprotocol/python-sdk/issues before opening this issue Description Three tests in TestChi...
Open Graph Description: Initial Checks I confirm that I'm using the latest version of MCP Python SDK I confirm that I searched for my issue in https://github.com/modelcontextprotocol/python-sdk/issues before opening this ...
X Description: Initial Checks I confirm that I'm using the latest version of MCP Python SDK I confirm that I searched for my issue in https://github.com/modelcontextprotocol/python-sdk/issues before opening t...
Opengraph URL: https://github.com/modelcontextprotocol/python-sdk/issues/1775
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Fix flaky tests in TestChildProcessCleanup (test_stdio.py)","articleBody":"### Initial Checks\n\n- [x] I confirm that I'm using the latest version of MCP Python SDK\n- [x] I confirm that I searched for my issue in https://github.com/modelcontextprotocol/python-sdk/issues before opening this issue\n\n### Description\n\nThree tests in `TestChildProcessCleanup` are flaky. They fail intermittently on macOS (darwin) with the same root cause: the child process hasn't started writing to the marker file before the assertion checks.\n\n**Affected tests:**\n- `TestChildProcessCleanup.test_basic_child_process_cleanup`\n- `TestChildProcessCleanup.test_nested_process_tree`\n- `TestChildProcessCleanup.test_early_parent_exit`\n\n**CI evidence:** Tests observed failing on 2025-11-12 and continue to be flaky.\n\n**Output:**\n\n```python\n________ TestChildProcessCleanup.test_basic_child_process_cleanup ________\n[gw9] darwin -- Python 3.11.14\n\n async def test_basic_child_process_cleanup(self):\n ...\n # Verify child is writing\n if os.path.exists(marker_file): # pragma: no branch\n initial_size = os.path.getsize(marker_file)\n await anyio.sleep(0.3)\n size_after_wait = os.path.getsize(marker_file)\n\u003e assert size_after_wait \u003e initial_size, \"Child process should be writing\"\nE AssertionError: Child process should be writing\nE assert 0 \u003e 0\n\ntests/client/test_stdio.py:310: AssertionError\n```\n\n```python\n________ TestChildProcessCleanup.test_nested_process_tree ________\n[gw9] darwin -- Python 3.11.14\n\n\u003e assert new_size \u003e initial_size, f\"{name} process should be writing\"\nE AssertionError: parent process should be writing\nE assert 0 \u003e 0\n\ntests/client/test_stdio.py:413: AssertionError\n```\n\n```python\n________ TestChildProcessCleanup.test_early_parent_exit ________\n[gw9] darwin -- Python 3.11.14\n\n\u003e assert size2 \u003e size1, \"Child should be writing\"\nE AssertionError: Child should be writing\nE assert 0 \u003e 0\n\ntests/client/test_stdio.py:494: AssertionError\n```\n\n### Python \u0026 MCP Python SDK\n\n```Text\nPython 3.11.14, macOS (darwin)\nLatest SDK version\n```\n\n\u003csub\u003e[AI Disclaimer](https://gist.github.com/maxisbey/6123d132484e4c533eab519a2800693d)\u003c/sub\u003e","author":{"url":"https://github.com/maxisbey","@type":"Person","name":"maxisbey"},"datePublished":"2025-12-11T14:19:18.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/1775/python-sdk/issues/1775"}
| 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:88d19856-9c51-f159-d3d2-d116fa0750d6 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9C10:141C37:1DB9D8C:2A3710D:6A5A3964 |
| html-safe-nonce | 2fe18fd55856b65bb5e42e245de843c56ba929e0d1ef8ff8da7cea5b385d20f0 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5QzEwOjE0MUMzNzoxREI5RDhDOjJBMzcxMEQ6NkE1QTM5NjQiLCJ2aXNpdG9yX2lkIjoiNDc4NDY4MDA4NjIyODMxOTcyIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 77e96589c5ffcc00785c3d546c04576d28d9fd332560c68dc4df9a834fda51b4 |
| hovercard-subject-tag | issue:3719598565 |
| 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/1775/issue_layout |
| twitter:image | https://opengraph.githubassets.com/c1c1919cd5c7e7af2abcd27cb54a9af133c13fa73de6a837f3df8576398e5699/modelcontextprotocol/python-sdk/issues/1775 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/c1c1919cd5c7e7af2abcd27cb54a9af133c13fa73de6a837f3df8576398e5699/modelcontextprotocol/python-sdk/issues/1775 |
| og:image:alt | Initial Checks I confirm that I'm using the latest version of MCP Python SDK I confirm that I searched for my issue in https://github.com/modelcontextprotocol/python-sdk/issues before opening this ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | maxisbey |
| hostname | github.com |
| expected-hostname | github.com |
| None | 19c67ad7579d2401ff06e88a32ef45460fbb40fab3191c7f7582d5e166f326fc |
| 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 | e618485bff22dab2ef1ffb4e34e4e6626688df69 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width