| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
2026-05-13: Filed issue.
2026-06-08: Added new findings (16) and (86).
I found 22 free-threading race conditions during a partial Xint Code scan of cpython. These only apply to the free-threaded build, and were all found and tested on commit 0534774 built with ./configure --disable-gil --enable-asan on an M3 Mac.
I'm attaching a zip file with detailed writeups of each, as well as reproduction cases for 15 of the 22 issues. I don't have scripts reproducing the findings numbered 21, 36, 82, 94, 106, 115, or 124. Race conditions can be difficult to trigger, and even the scripts I provided are trying to win tight races and may not always work.
I know this is a lot. @colesbury suggested I create a combined issue to make the triage discussion easier.
Let me know if you have any questions or concerns. The issues were found and written up by an automated system, but I have put additional work into the validation and reporting. I do want to be respectful of everyone's time while helping to make Python better.
2026-05-13: Initial writeups and test scripts: cpython-ft.zip
2026-06-08: New writeups and test scripts for (16) and (86): cpython-ft-2026-06-08.zip
Many of the scripts are expected to crash, however some of them only produce exceptions or corrupted output. You should be able to run any of the scripts with PYTHON_GIL=1 set in your environment if you want to see a baseline without the race condition.
3.14
macOS
| Back | FazBrowse Home | New Git URL |
Activity
skirpichev commented on May 14, 2026
Is this is same as #143379?
lunixbochs commented on May 14, 2026
Looks pretty similar, just as a threading race instead of reentrancy.
skirpichev commented on May 14, 2026
Then I think it's not something worth fixing, on same ground.
pythongh-149816: Fix a RC in `_random.Random.__init__` method
kumaraditya303 commented on May 14, 2026
I don't think it is worth fixing issues of calling __init__ in multiple threads.
lunixbochs commented on May 14, 2026
Neither of the mentioned init bugs (struct / random) are init racing with itself, they're init racing with something else. The struct bug is far more contrived because it requires you to call init a second time while using the struct object. The random init/sample race seems fine to fix because if someone ever does manage to hit that they won't even get a crash, just incorrect numbers out of their seeded rng.
There's a separate question on the cpython philosophy of "should a script be able to intentionally crash or memory corrupt the interpreter using the stdlib and no ctypes?", which should inform whether more contrived reentrancy issues / race conditions should be fixed
picnixz commented on May 15, 2026
I will have a look at all issues related to SSL and crypto myself in 10 days unless someone beats me to it.
gh-149816: Fix race condition in `memoryview` with free-threading (#1…
[3.14] gh-149816: Fix race condition in `memoryview` with free-thread…
[3.15] gh-149816: Fix race condition in `memoryview` with free-thread…
gh-149816: Fix a race condition in `_PyBytes_FromList` with free-thre…
sobolevn commented on May 16, 2026
(36) does not seem correct, because _PyType_Lookup is supposed to return the borrowed reference by design.
56 remaining items
[3.14] gh-149816: Fix UAF in Modules/_pickle.c (GH-150024) (GH-153719)
Merge branch 'main' into pythongh-149816-96
gh-149816: #96 Fix a race condition in invoke_gc_callback with free t…
[3.15] gh-149816: #96 Fix a race condition in invoke_gc_callback with…
gh-149816: Fix race in subtype_getweakref in free-threading build (gh…
lunixbochs commented on Oct 12, 2026
picnixz commented on Oct 12, 2026
[3.14] gh-149816: Fix race in subtype_getweakref in free-threading bu…
[3.15] gh-149816: Fix race in subtype_getweakref in free-threading bu…