diff options
author | Eric Snow <ericsnowcurrently@gmail.com> | 2023-07-28 23:16:12 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-28 23:16:12 (GMT) |
commit | da151fdc7ac4a6d30740e4ef18071936a136790d (patch) | |
tree | 539f4fca2d647e02d9efeb9ddac8006c83c8f82a /Modules/posixmodule.c | |
parent | e5ca2aa2c6d86842183565606afcd0f85ed3eac9 (diff) | |
download | cpython-da151fdc7ac4a6d30740e4ef18071936a136790d.zip cpython-da151fdc7ac4a6d30740e4ef18071936a136790d.tar.gz cpython-da151fdc7ac4a6d30740e4ef18071936a136790d.tar.bz2 |
[3.12] gh-105699: Use a _Py_hashtable_t for the PyModuleDef Cache (gh-106974) (gh-107412)
gh-105699: Use a _Py_hashtable_t for the PyModuleDef Cache (gh-106974)
This fixes a crasher due to a race condition, triggered infrequently when two isolated (own GIL) subinterpreters simultaneously initialize their sys or builtins modules. The crash happened due the combination of the "detached" thread state we were using and the "last holder" logic we use for the GIL. It turns out it's tricky to use the same thread state for different threads. Who could have guessed?
We solve the problem by eliminating the one object we were still sharing between interpreters. We replace it with a low-level hashtable, using the "raw" allocator to avoid tying it to the main interpreter.
We also remove the accommodations for "detached" thread states, which were a dubious idea to start with.
(cherry picked from commit 8ba4df91ae60833723d8d3b9afeb2b642f7176d5)
Diffstat (limited to 'Modules/posixmodule.c')
0 files changed, 0 insertions, 0 deletions