René's URL Explorer Experiment


Title: Free-threaded GC can abort during concurrent subinterpreter teardown · Issue #161751 · python/cpython · GitHub

Open Graph Title: Free-threaded GC can abort during concurrent subinterpreter teardown · Issue #161751 · python/cpython

X Title: Free-threaded GC can abort during concurrent subinterpreter teardown · Issue #161751 · python/cpython

Description: Crash report OpTree CI hit this assertion on an unmodified Windows x64 free-threaded debug build of CPython 3.14.10 (b703b2c). An InterpreterPoolExecutor worker was destroying its interpreter. The native stack went from Py_EndInterpreter...

Open Graph Description: Crash report OpTree CI hit this assertion on an unmodified Windows x64 free-threaded debug build of CPython 3.14.10 (b703b2c). An InterpreterPoolExecutor worker was destroying its interpreter. The ...

X Description: Crash report OpTree CI hit this assertion on an unmodified Windows x64 free-threaded debug build of CPython 3.14.10 (b703b2c). An InterpreterPoolExecutor worker was destroying its interpreter. The ...

Opengraph URL: https://github.com/python/cpython/issues/161751

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Free-threaded GC can abort during concurrent subinterpreter teardown","articleBody":"### Crash report\n\n[OpTree](https://github.com/metaopt/optree/) CI hit this assertion on an unmodified Windows x64 free-threaded debug build of CPython 3.14.10 (`b703b2c`). An `InterpreterPoolExecutor` worker was destroying its interpreter. The native stack went from `Py_EndInterpreter()` through shutdown GC to `mi_abandoned_visit_blocks()` and `validate_alive_bits()`.\n\nCI backtrace: https://github.com/metaopt/optree/actions/runs/42811376193/job/129813367183#step:18:1\n\n```text\nPython/gc_free_threading.c:1082: validate_alive_bits:\nAssertion \"!gc_is_alive(op)\" failed: object should not be marked as alive yet\n```\n\nI suspect a race in the abandoned-segment scan introduced with the mimalloc 2.5.2 update. One interpreter can temporarily clear a segment’s bitmap bit, discover that the segment belongs to another interpreter, and restore the bit. The owning interpreter’s GC reads the bitmap **before** acquiring `abandoned_visit_lock`. If it reads during that interval, it can skip the segment. The same scan is present on `main` at `9d4a35c`.\n\nAllocator code: https://github.com/python/cpython/blob/v3.14.10/Objects/mimalloc/arena-abandon.c#L209-L269\n\n- 3.14 backport: #160183\n\n---\n\n### Standard Library Reproducer\n\nStarting from `v3.14.10`, add `usleep(100);` inside the foreign-segment branch of `mi_arena_segment_clear_abandoned_at()`, immediately before it restores the bitmap bit.\n\n```diff\n   if (segment->subproc != subproc) {\n+    usleep(100);\n     // it is from another sub-process, re-mark it and continue searching\n```\n\nBuild with `./configure --with-pydebug --disable-gil` and `make`. Save this as `repro.py` and run `./python.exe -I -X dev repro.py` on macOS.\n\n```python\nfrom concurrent import interpreters\nfrom concurrent.futures import ThreadPoolExecutor\nfrom threading import Barrier\n\nworkers = 8\nbarrier = Barrier(workers)\n\n\ndef run(_worker_id):\n    for _ in range(10):\n        interp = interpreters.create()\n        barrier.wait()\n        interp.exec('import gc\\ngc.collect()')\n        interp.close()\n\n\nwith ThreadPoolExecutor(workers) as pool:\n    list(pool.map(run, range(workers)))\n```\n\nWith the timing change, this reduced case aborted in `validate_gc_objects()` on all three runs. A longer standard-library stress test also reproduced the exact `validate_alive_bits()` assertion from Windows. On stock macOS debug builds, that longer test completed 340 rounds each on 3.14.9 and 3.14.10.\n\nAs a control, I kept the delay and moved lock acquisition ahead of the first bitmap read for full scans (`previous->visit_all`). The longer workload then completed a 10-round run. The precise thread interleaving in the original Windows crash is unknown.\n\n### CPython versions tested on:\n\n3.14\n\n### Operating systems tested on:\n\nmacOS\n\n### Output from running 'python -VV' on the command line:\n\n_No response_\n\n\u003c!-- gh-linked-prs -->\n### Linked PRs\n* gh-162003\n* gh-162269\n* gh-162270\n\u003c!-- /gh-linked-prs -->\n","author":{"url":"https://github.com/XuehaiPan","@type":"Person","name":"XuehaiPan"},"datePublished":"2026-11-10T15:59:52Z","url":"https://github.com/python/cpython/issues/161751"}

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:47bc7b18-c892-4a4d-269e-c7fc36fee851
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idB880:317608:3DC7811:4E3066F:6B0207C9
html-safe-noncef88c5553d28251475a55c98f83aab36c897908447e3331d20e5790c3f27ace10
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCODgwOjMxNzYwODozREM3ODExOjRFMzA2NkY6NkIwMjA3QzkiLCJ2aXNpdG9yX2lkIjoiMTA5OTAyMjIzOTUyMjc1MjQ1NyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmacd0b2210fc8d85e925824f47df9514c88451093f82ef024b54399d4795cd50a47
hovercard-subject-tagissue:6310602307
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/cpython/161751/issue_layout
twitter:imagehttps://opengraph.githubassets.com/3780e4b1cbb2d52f4789d5fdc6896fe1a7b61fda253b2010ac3ef10e15e09b8e/python/cpython/issues/161751
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/3780e4b1cbb2d52f4789d5fdc6896fe1a7b61fda253b2010ac3ef10e15e09b8e/python/cpython/issues/161751
og:image:altCrash report OpTree CI hit this assertion on an unmodified Windows x64 free-threaded debug build of CPython 3.14.10 (b703b2c). An InterpreterPoolExecutor worker was destroying its interpreter. The ...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameXuehaiPan
hostnamegithub.com
expected-hostnamegithub.com
None87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456
turbo-cache-controlno-preview
go-importgithub.com/python/cpython git https://github.com/python/cpython.git
octolytics-dimension-user_id1525981
octolytics-dimension-user_loginpython
octolytics-dimension-repository_id81598961
octolytics-dimension-repository_nwopython/cpython
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id81598961
octolytics-dimension-repository_network_root_nwopython/cpython
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
release423dbb54c5e7bfecc838eb387c1435eb3d0e760d
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/python/cpython/issues/161751#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fissues%2F161751
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
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
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://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
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fissues%2F161751
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=python%2Fcpython
Reloadhttps://github.com/python/cpython/issues/161751
Reloadhttps://github.com/python/cpython/issues/161751
Reloadhttps://github.com/python/cpython/issues/161751
pythonhttps://github.com/python
cpythonhttps://github.com/python/cpython
Codehttps://github.com/python/cpython
Issues5k+ (5k+)https://github.com/python/cpython/issues
Pull requests2.4k (2.4k)https://github.com/python/cpython/pulls
Actionshttps://github.com/python/cpython/actions
Projectshttps://github.com/python/cpython/projects
Security and qualityhttps://github.com/python/cpython/security
Insightshttps://github.com/python/cpython/insights
https://github.com/python/cpython
New issuehttps://github.com/login?return_to=https://github.com/python/cpython/issues/161751
New issuehttps://github.com/login?return_to=https://github.com/python/cpython/issues/161751
Free-threaded GC can abort during concurrent subinterpreter teardownhttps://github.com/python/cpython/issues/161751#top
https://github.com/corona10
interpreter-core(Objects, Python, Grammar, and Parser dirs)https://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22interpreter-core%22
topic-free-threadinghttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22topic-free-threading%22
type-crashA hard crash of the interpreter, possibly with a core dumphttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22type-crash%22
https://github.com/XuehaiPan
XuehaiPanhttps://github.com/XuehaiPan
on Nov 10, 2026https://github.com/python/cpython/issues/161751#issue-6310602307
OpTreehttps://github.com/metaopt/optree/
https://github.com/metaopt/optree/actions/runs/42811376193/job/129813367183#step:18:1https://github.com/metaopt/optree/actions/runs/42811376193/job/129813367183#step:18:1
https://github.com/python/cpython/blob/v3.14.10/Objects/mimalloc/arena-abandon.c#L209-L269https://github.com/python/cpython/blob/v3.14.10/Objects/mimalloc/arena-abandon.c#L209-L269
[3.14] gh-159111: Update vendored mimalloc to v2.5.2 (gh-159112) #160183https://github.com/python/cpython/pull/160183
gh-161751: Fix race in mimalloc abandoned segment visit #162003https://github.com/python/cpython/pull/162003
[3.15] gh-161751: Fix race in mimalloc abandoned segment visit (gh-162003) #162269https://github.com/python/cpython/pull/162269
[3.14] gh-161751: Fix race in mimalloc abandoned segment visit (gh-162003) #162270https://github.com/python/cpython/pull/162270
XuehaiPanhttps://github.com/XuehaiPan
type-crashA hard crash of the interpreter, possibly with a core dumphttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22type-crash%22
on Nov 10, 2026https://github.com/python/cpython/issues/161751#event-35700655384
sergey-miryanovhttps://github.com/sergey-miryanov
interpreter-core(Objects, Python, Grammar, and Parser dirs)https://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22interpreter-core%22
topic-free-threadinghttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22topic-free-threading%22
on Nov 10, 2026https://github.com/python/cpython/issues/161751#event-35701391879
https://github.com/sergey-miryanov
sergey-miryanovhttps://github.com/sergey-miryanov
on Nov 10, 2026https://github.com/python/cpython/issues/161751#issuecomment-6772423018
@naschemehttps://github.com/nascheme
corona10https://github.com/corona10
on Nov 14, 2026https://github.com/python/cpython/issues/161751#event-36126065988
corona10https://github.com/corona10
on Nov 14, 2026https://github.com/python/cpython/issues/161751#event-36128585190
pythongh-161751: Fix race in mimalloc abandoned segment visit in free…https://github.com/corona10/cpython/commit/604469a0d2ff7a7d0601c5922cafb4ded6fa8f8b
pythongh-161751https://github.com/python/cpython/issues/161751
604469ahttps://github.com/corona10/cpython/commit/604469a0d2ff7a7d0601c5922cafb4ded6fa8f8b
gh-161751: Fix race in mimalloc abandoned segment visit (gh-162003)https://github.com/python/cpython/commit/484bc16723ef534e693bcd13e139ccd710a64da4
gh-161751https://github.com/python/cpython/issues/161751
gh-162003https://github.com/python/cpython/pull/162003
484bc16https://github.com/python/cpython/commit/484bc16723ef534e693bcd13e139ccd710a64da4
[3.14] gh-161751: Fix race in mimalloc abandoned segment visit (gh-16…https://github.com/python/cpython/commit/320b59196ebd9cbc2f8be18326d65c7e8603dc93
gh-161751https://github.com/python/cpython/issues/161751
gh-16…https://github.com/python/cpython/pull/162003
320b591https://github.com/python/cpython/commit/320b59196ebd9cbc2f8be18326d65c7e8603dc93
[3.15] gh-161751: Fix race in mimalloc abandoned segment visit (gh-16…https://github.com/python/cpython/commit/b61e53854c33af7bc226022ed50684efe0bd8728
gh-161751https://github.com/python/cpython/issues/161751
gh-16…https://github.com/python/cpython/pull/162003
b61e538https://github.com/python/cpython/commit/b61e53854c33af7bc226022ed50684efe0bd8728
corona10https://github.com/corona10
completedhttps://github.com/python/cpython/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
on Nov 19, 2026https://github.com/python/cpython/issues/161751#event-36700892375
Sign up for freehttps://github.com/signup?return_to=https://github.com/python/cpython/issues/161751
Sign in to commenthttps://github.com/login?return_to=https://github.com/python/cpython/issues/161751
corona10https://github.com/corona10
interpreter-core(Objects, Python, Grammar, and Parser dirs)https://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22interpreter-core%22
topic-free-threadinghttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22topic-free-threading%22
type-crashA hard crash of the interpreter, possibly with a core dumphttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22type-crash%22
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.