René's URL Explorer Experiment


Title: Py_Initialize() in a background thread crashes on free-threaded release builds of 3.14 after the mimalloc 2.5.2 update · Issue #160588 · python/cpython · GitHub

Open Graph Title: Py_Initialize() in a background thread crashes on free-threaded release builds of 3.14 after the mimalloc 2.5.2 update · Issue #160588 · python/cpython

X Title: Py_Initialize() in a background thread crashes on free-threaded release builds of 3.14 after the mimalloc 2.5.2 update · Issue #160588 · python/cpython

Description: Crash report On the 3.14 branch, a free-threaded release build (./configure --disable-gil) crashes when Py_Initialize() is called in a thread other than the main thread. test_embed's test_init_in_background_thread, added for gh-123022, f...

Open Graph Description: Crash report On the 3.14 branch, a free-threaded release build (./configure --disable-gil) crashes when Py_Initialize() is called in a thread other than the main thread. test_embed's test_init_in_b...

X Description: Crash report On the 3.14 branch, a free-threaded release build (./configure --disable-gil) crashes when Py_Initialize() is called in a thread other than the main thread. test_embed's test_init_...

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

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Py_Initialize() in a background thread crashes on free-threaded release builds of 3.14 after the mimalloc 2.5.2 update","articleBody":"### Crash report\n\nOn the 3.14 branch, a free-threaded release build (`./configure --disable-gil`) crashes when `Py_Initialize()` is called in a thread other than the main thread. `test_embed`'s `test_init_in_background_thread`, added for gh-123022, fails on every run: `./Programs/_testembed test_init_in_background_thread` crashed 20 times out of 20. Under lldb (trimmed):\n\n```\n$ lldb -- ./Programs/_testembed test_init_in_background_thread\n* thread #2, stop reason = EXC_BAD_ACCESS (code=2, address=0x100411738)\n  frame #0: chacha_block(ctx=0x00000001004116f8) at random.c:67:20\n  frame #1: chacha_next32 at random.c:83:5 [inlined]\n  frame #2: _mi_random_next at random.c:154:22 [inlined]\n  frame #3: _mi_heap_random_next(heap=0x00000001004116c0) at heap.c:281:10 [inlined]\n  frame #4: _mi_os_get_aligned_hint(try_alignment=33554432, size=1107296256) at os.c:129:19\n  frame #5: unix_mmap_prim_aligned at prim.c:281:18\n  ...\n  frame #11: mi_reserve_os_memory_ex(size=1073741824, ...) at arena.c:917:17\n```\n\nIt also fails in the tail-call workflow on my fork (x86_64-unknown-linux-gnu/gcc-free-threading, `bad returncode -11`): https://github.com/devdavidejesus/cpython/actions/runs/40045549694\n\nIn 3.14.9, `_mi_os_get_aligned_hint()` and `mi_os_claim_huge_pages()` in `Objects/mimalloc/os.c` only call `_mi_heap_random_next()` if `mi_heap_is_initialized(heap)`; that check is the gh-123022 fix. The mimalloc 2.5.2 update (gh-159111, 1bcc0d165ae on 3.14) dropped it. In a new thread the default heap is still `_mi_heap_empty`, which is `const`, so the write in `chacha_block()` faults (`heap` in frame #3 is `_mi_heap_empty`).\n\nDebug builds are not affected, because this code is under `#if (MI_SECURE>0 || MI_DEBUG==0)` and `MI_DEBUG` is 2 with `Py_DEBUG`. The free-threaded jobs in the main CI workflow are debug builds, which is probably why this was not caught there.\n\nThe check is also missing on main and 3.15, but this test does not crash on main: there, as on 3.15, free-threaded builds use mimalloc for the raw domain (`MIMALLOC_RAWALLOC`), so the first `PyMem_RawMalloc()` call in the thread initializes its default heap. On 3.14 the raw domain uses `malloc()`.\n\nRestoring the check fixes the crash: the test then passes 20 of 20 times, and `test_embed` passes. (For main, gh-113141 notes that with mimalloc v3, proposed in gh-159718, \"The gh-123022 patch no longer applies\".)\n\n### CPython versions tested on:\n\n3.14, CPython main branch\n\n### Operating systems tested on:\n\nmacOS, Linux\n\n### Output from running 'python -VV' on the command line:\n\nPython 3.14.9+ free-threading build (remotes/upstream/3.14:aa3903e80a4, Oct 24 2026, 08:12:26) [Clang 21.0.0 (clang-2100.3.34.2)]\n\n\n\u003c!-- gh-linked-prs -->\n### Linked PRs\n* gh-160589\n* gh-160611\n* gh-160612\n\u003c!-- /gh-linked-prs -->\n","author":{"url":"https://github.com/devdavidejesus","@type":"Person","name":"devdavidejesus"},"datePublished":"2026-10-24T11:37:37Z","url":"https://github.com/python/cpython/issues/160588"}

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:5d0183bf-3733-b2ca-00d5-fa67818d89c7
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idA8F2:33444D:3633E7E:480B600:6B0209D0
html-safe-nonceb0fedbcb9de8c854c7b67bffa8e0583594a4f829a1cc04045ed4f49c9dce7745
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBOEYyOjMzNDQ0RDozNjMzRTdFOjQ4MEI2MDA6NkIwMjA5RDAiLCJ2aXNpdG9yX2lkIjoiMjk4NzcxNDE0NDkzMDc2MTE2OCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac3efb18989ccb11f983ee338f0537de4c257e06beb96baeb84c025594256f392f
hovercard-subject-tagissue:6012515221
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/160588/issue_layout
twitter:imagehttps://opengraph.githubassets.com/448464f0a4efbe97264680bcdfbffb0aab965310c4e6dbca756bfabfabd56659/python/cpython/issues/160588
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/448464f0a4efbe97264680bcdfbffb0aab965310c4e6dbca756bfabfabd56659/python/cpython/issues/160588
og:image:altCrash report On the 3.14 branch, a free-threaded release build (./configure --disable-gil) crashes when Py_Initialize() is called in a thread other than the main thread. test_embed's test_init_in_b...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamedevdavidejesus
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-targetcanary-1
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/python/cpython/issues/160588#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fissues%2F160588
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%2F160588
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/160588
Reloadhttps://github.com/python/cpython/issues/160588
Reloadhttps://github.com/python/cpython/issues/160588
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/160588
New issuehttps://github.com/login?return_to=https://github.com/python/cpython/issues/160588
Py_Initialize() in a background thread crashes on free-threaded release builds of 3.14 after the mimalloc 2.5.2 updatehttps://github.com/python/cpython/issues/160588#top
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/devdavidejesus
devdavidejesushttps://github.com/devdavidejesus
on Oct 24, 2026https://github.com/python/cpython/issues/160588#issue-6012515221
gh-123022https://github.com/python/cpython/issues/123022
https://github.com/devdavidejesus/cpython/actions/runs/40045549694https://github.com/devdavidejesus/cpython/actions/runs/40045549694
gh-123022https://github.com/python/cpython/issues/123022
gh-159111https://github.com/python/cpython/issues/159111
1bcc0d1https://github.com/python/cpython/commit/1bcc0d165ae66f5d88db5c5bcab82908d9a49537
#3https://github.com/python/cpython/pull/3
gh-113141https://github.com/python/cpython/issues/113141
gh-159718https://github.com/python/cpython/pull/159718
gh-123022https://github.com/python/cpython/issues/123022
gh-160588: Restore the gh-123022 check in the vendored mimalloc #160589https://github.com/python/cpython/pull/160589
[3.15] gh-160588: Restore the gh-123022 check in the vendored mimalloc (GH-160589) #160611https://github.com/python/cpython/pull/160611
[3.14] gh-160588: Restore the gh-123022 check in the vendored mimalloc (GH-160589) #160612https://github.com/python/cpython/pull/160612
NekoAsakurahttps://github.com/NekoAsakura
interpreter-core(Objects, Python, Grammar, and Parser dirs)https://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22interpreter-core%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
topic-free-threadinghttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22topic-free-threading%22
on Oct 24, 2026https://github.com/python/cpython/issues/160588#event-34131811177
hugovkhttps://github.com/hugovk
on Oct 24, 2026https://github.com/python/cpython/issues/160588#event-34141339985
gh-160588: Restore the gh-123022 check in the vendored mimalloc (#160589https://github.com/python/cpython/commit/34889af65891907fa165808900f48cce241fdfb3
gh-160588https://github.com/python/cpython/issues/160588
gh-123022https://github.com/python/cpython/issues/123022
#160589https://github.com/python/cpython/pull/160589
34889afhttps://github.com/python/cpython/commit/34889af65891907fa165808900f48cce241fdfb3
hugovkhttps://github.com/hugovk
completedhttps://github.com/python/cpython/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
on Oct 24, 2026https://github.com/python/cpython/issues/160588#event-34141447662
hugovkhttps://github.com/hugovk
on Oct 24, 2026https://github.com/python/cpython/issues/160588#event-34142576614
[3.14] gh-160588: Restore the gh-123022 check in the vendored mimalloc (https://github.com/python/cpython/commit/8a3454f427dc065ad2884d082627138997c85800
gh-160588https://github.com/python/cpython/issues/160588
gh-123022https://github.com/python/cpython/issues/123022
8a3454fhttps://github.com/python/cpython/commit/8a3454f427dc065ad2884d082627138997c85800
[3.15] gh-160588: Restore the gh-123022 check in the vendored mimalloc (https://github.com/python/cpython/commit/45fbdddfa1d9f2b9e2fe7d553a47b4e31104ed65
gh-160588https://github.com/python/cpython/issues/160588
gh-123022https://github.com/python/cpython/issues/123022
45fbdddhttps://github.com/python/cpython/commit/45fbdddfa1d9f2b9e2fe7d553a47b4e31104ed65
Sign up for freehttps://github.com/signup?return_to=https://github.com/python/cpython/issues/160588
Sign in to commenthttps://github.com/login?return_to=https://github.com/python/cpython/issues/160588
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.