Skip to content

Conversation

@colesbury
Copy link
Contributor

@colesbury colesbury commented Nov 15, 2021

Unlike the other locks reinitialized by _PyRuntimeState_ReInitThreads,
the "interpreters.main->id_mutex" is not freed by _PyRuntimeState_Fini
and should not force the default raw allocator.

https://bugs.python.org/issue42540

Unlike the other locks reinitialized by _PyRuntimeState_ReInitThreads, the "interpreters.main->id_mutex" is not freed by _PyRuntimeState_Fini and should not force the default raw allocator.
@colesbury
Copy link
Contributor Author

@vstinner, if you have some time would you also please look over this?

An alternative fix would be to only allocate and free the id_mutex fields using the default raw allocator. I wasn't sure if that's better, so I went with the smaller change of re-initializing the mutex using the current raw allocator. (i.e. the same allocator used by PyInterpreterState_Delete)

@colesbury
Copy link
Contributor Author

Thanks for reviewing this @vstinner. I've updated the PR.

@vstinner vstinner merged commit 736684b into python:main Nov 17, 2021
@miss-islington
Copy link
Contributor

Thanks @colesbury for the PR, and @vstinner for merging it 🌮🎉.. I'm working now to backport this PR to: 3.9, 3.10.
🐍🍒⛏🤖

@miss-islington
Copy link
Contributor

Sorry, @colesbury and @vstinner, I could not cleanly backport this to 3.9 due to a conflict.
Please backport using cherry_picker on command line.
cherry_picker 736684b1bb67369a2e95a9f621752deead44e7ef 3.9

@bedevere-bot
Copy link

GH-29599 is a backport of this pull request to the 3.10 branch.

@bedevere-bot bedevere-bot removed the needs backport to 3.10 only security fixes label Nov 17, 2021
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Nov 17, 2021
pythonGH-29564) Unlike the other locks reinitialized by _PyRuntimeState_ReInitThreads, the "interpreters.main->id_mutex" is not freed by _PyRuntimeState_Fini and should not force the default raw allocator. (cherry picked from commit 736684b) Co-authored-by: Sam Gross <colesbury@gmail.com>
@vstinner
Copy link
Member

On 3.9, there is a conflict since the code is different (reinit_unicode_ids didn't exist). Can you try to manually create a backport of your fix to 3.9?

@bedevere-bot
Copy link

GH-29600 is a backport of this pull request to the 3.9 branch.

miss-islington added a commit that referenced this pull request Nov 17, 2021
GH-29564) Unlike the other locks reinitialized by _PyRuntimeState_ReInitThreads, the "interpreters.main->id_mutex" is not freed by _PyRuntimeState_Fini and should not force the default raw allocator. (cherry picked from commit 736684b) Co-authored-by: Sam Gross <colesbury@gmail.com>
ambv pushed a commit that referenced this pull request Nov 17, 2021
…locator (GH-29564) (GH-29600) Unlike the other locks reinitialized by _PyRuntimeState_ReInitThreads, the "interpreters.main->id_mutex" is not freed by _PyRuntimeState_Fini and should not force the default raw allocator.. (cherry picked from commit 736684b) Co-authored-by: Sam Gross <colesbury@gmail.com>
@colesbury colesbury deleted the issue42540 branch November 18, 2021 19:15
remykarem pushed a commit to remykarem/cpython that referenced this pull request Dec 7, 2021
pythonGH-29564) Unlike the other locks reinitialized by _PyRuntimeState_ReInitThreads, the "interpreters.main->id_mutex" is not freed by _PyRuntimeState_Fini and should not force the default raw allocator.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

5 participants