Repository navigation
gh-160588: Restore the gh-123022 check in the vendored mimalloc - #160589
Merged
Merged
Conversation
…malloc The mimalloc 2.5.2 update dropped the check that skips _mi_heap_random_next() while the thread's default heap is not initialized. Without it, Py_Initialize() in a background thread crashes on free-threaded release builds of 3.14.
Member
|
cc @corona10 @DinoV Does this help #160183 (comment) ? We may need some security releases soon, so we'll need https://buildbot.python.org/release-status back to green, which may otherwise require a revert of #160183. |
|
Thanks @devdavidejesus for the PR, and @hugovk for merging it 🌮🎉.. I'm working now to backport this PR to: 3.14, 3.15. |
|
GH-160611 is a backport of this pull request to the 3.15 branch. |
|
GH-160612 is a backport of this pull request to the 3.14 branch. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The mimalloc 2.5.2 update (gh-159111) dropped the CPython-specific check from gh-123022 in
Objects/mimalloc/os.c, which skips_mi_heap_random_next()while the thread's default heap is not initialized. It looks like another downstream change lost in the upgrade, like the ones restored in gh-160207. This restores it as it was before the update.On 3.14 the missing check makes
Py_Initialize()in a background thread crash on free-threaded release builds (test_init_in_background_threadfails). On main the test passes even without the check, because the raw domain already initializes the heap; the change is here so that it can be backported to 3.15 and 3.14. If gh-159718 (mimalloc v3) lands first, this is not needed on main and could go to 3.15 and 3.14 directly.Tested on macOS with free-threaded release builds: with this change the test passes 20 of 20 times on 3.14 (20 of 20 crashes without it), and
test_embedpasses on main and 3.14.No NEWS entry: the regression is not in any release yet (3.14.9 still has the check).
See #160588.