cpython/Tools/tsan
Miss Islington (bot) ee7d2681f6
[3.13] gh-117657: Fix race involving GC and heap initialization (GH-119923) (#120038)
The `_PyThreadState_Bind()` function is called before the first
`PyEval_AcquireThread()` so it's not synchronized with the stop the
world GC. We had a race where `gc_visit_heaps()` might visit a thread's
heap while it's being initialized.

Use a simple atomic int to avoid visiting heaps for threads that are not
yet fully initialized (i.e., before `tstate_mimalloc_bind()` is called).

The race was reproducible by running:
`python Lib/test/test_importlib/partial/pool_in_threads.py`.
(cherry picked from commit e69d068ad0)

Co-authored-by: Sam Gross <colesbury@gmail.com>
2024-06-04 14:08:10 +00:00
..
suppressions_free_threading.txt [3.13] gh-117657: Fix race involving GC and heap initialization (GH-119923) (#120038) 2024-06-04 14:08:10 +00:00
supressions.txt [3.13] gh-117657: Log TSAN warnings to separate files and archive them (GH-118747) (#118931) 2024-05-10 22:27:17 +00:00