| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
| |
(GH-119368) (#120655)
Fix a race in `PyMember_GetOne` and `PyMember_SetOne` for `Py_T_OBJECT_EX`.
These functions implement `__slots__` accesses for Python objects.
(cherry picked from commit 362cd2680b45a36c3467b9721ff7fc0ceb338452)
Co-authored-by: Daniele Parmeggiani <8658291+dpdani@users.noreply.github.com>
|
|
|
|
|
|
|
| |
(#120654)
(cherry picked from commit 460cc9e14e221c53c0038a847bfd411fe184ebf3)
Co-authored-by: Sam Gross <colesbury@gmail.com>
|
|
|
|
|
|
|
|
|
|
| |
(GH-120500) (#120510)
gh-117657: Add TSAN suppression for set_default_allocator_unlocked (GH-120500)
Add TSAN suppression for set_default_allocator_unlocked
(cherry picked from commit 2bacc2343c24c49292dea3461f6b7664fc2d33e2)
Co-authored-by: AN Long <aisk@users.noreply.github.com>
|
|
|
|
|
|
|
|
| |
gh-117657: Make PyType_HasFeature atomic (GH-120210)
Make PyType_HasFeature atomic
(cherry picked from commit eebae2c460dabdc70dc0d9b6e189368eb1abb716)
Co-authored-by: Ken Jin <kenjin@python.org>
|
|
|
|
|
|
|
|
|
|
| |
(GH-120403)
gh-117657: Make Py_TYPE and Py_SET_TYPE thread safe (GH-120165)
(cherry picked from commit e16aed63f64b18a26859eff3de976ded373e66b8)
Co-authored-by: Ken Jin <kenjin@python.org>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Nadeshiko Manju <me@manjusaka.me>
|
|
|
|
|
|
|
|
| |
This adds a `_PyRecursiveMutex` type based on `PyMutex` and uses that
for the import lock. This fixes some data races in the free-threaded
build and generally simplifies the import lock code.
(cherry picked from commit e21057b99967eb5323320e6d1121955e0cd2985e)
Co-authored-by: Sam Gross <colesbury@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
(#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 e69d068ad0bd6a25434ea476a647b635da4d82bb)
Co-authored-by: Sam Gross <colesbury@gmail.com>
|
|
|
|
|
|
| |
Fix itertools.count in free-threading mode
(cherry picked from commit 87939bd5790accea77c5a81093f16f28d3f0b429)
Co-authored-by: Arnon Yaari <wiggin15@yahoo.com>
|
|
|
|
|
|
|
|
|
|
|
| |
The free-threaded build currently immortalizes objects that use deferred
reference counting (see gh-117783). This typically happens once the
first non-main thread is created, but the behavior can be suppressed for
tests, in subinterpreters, or during a compile() call.
This fixes a race condition involving the tracking of whether the
behavior is suppressed.
(cherry picked from commit 47fb4327b5c405da6df066dcaa01b7c1aefab313)
|
|
|
|
|
|
|
| |
The `sem_clockwait` function is not currently instrumented, which leads
to false positives.
(cherry picked from commit 41c1cefbae71d687d1a935233b086473df65e15c)
Co-authored-by: Sam Gross <colesbury@gmail.com>
|
|
|
|
|
|
|
|
| |
(gh-119963)
gh-117657: Fix data races report by TSAN unicode-hash (gh-119907)
(cherry picked from commit 0594a27e5f1d87d59fa8a761dd8ca9df4e42816d)
Co-authored-by: Donghee Na <donghee.na@python.org>
|
|
|
|
|
|
|
|
|
| |
(GH-119921) (#119939)
The GIL may be disabled concurrently with this call so we need to use a
relaxed atomic load.
(cherry picked from commit f3b89a63cbb6d46e5ed40d5cd9813cdf9189ce35)
Co-authored-by: Sam Gross <colesbury@gmail.com>
|
|
|
|
|
|
|
|
| |
(#119914)
Seen in CI occasionally when running `test_weakref`.
(cherry picked from commit 7dc745d1f5d9558047a52cad5e01df7567533269)
Co-authored-by: Sam Gross <colesbury@gmail.com>
|
|
|
|
|
|
|
| |
Due to a limitation in TSAN, all reads from `PyThreadState.state` must be
atomic to avoid reported races.
(cherry picked from commit 90ec19fd33e2452902b9788d4821f1fbf6542304)
Co-authored-by: Sam Gross <colesbury@gmail.com>
|
|
|
|
|
|
|
|
| |
Only call `gc_restore_tid()` from stop-the-world contexts.
`worklist_pop()` can be called while other threads are running, so use a
relaxed atomic to modify `ob_tid`.
(cherry picked from commit 60593b2052ca275559c11028d50e19f8e5dfee13)
Co-authored-by: Sam Gross <colesbury@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
|
| |
(GH-118747) (#118931)
This ensures we don't lose races that occur in subprocesses or
interleave races from workers running in parallel.
Log files are collected and packaged into a zipfile that can be
downloaded from the "Artifacts" section of the workflow run.
(cherry picked from commit b88889e9ffd7b2d2bdac75aecbf14e37fd68e337)
Co-authored-by: mpage <mpage@meta.com>
|
|
|
|
|
|
|
|
|
| |
`_Py_qsbr_unregister` is called when the PyThreadState is already
detached, so the access to `tstate->qsbr` isn't safe without locking the
shared mutex. Grab the `struct _qsbr_shared` from the interpreter
instead.
(cherry picked from commit 33d20199af65c741bdc908a968edd8dc179b6974)
Co-authored-by: Alex Turner <alexturner@meta.com>
|
|
|
|
|
|
|
|
| |
(GH-118865) (#118904)
Use relaxed loads/stores when reading/writing to this field.
(cherry picked from commit 22d5185308f85efa22ec1e8251c409fe1cbd9e6b)
Co-authored-by: mpage <mpage@meta.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
(GH-118722) (#118870)
Using `race:` filters out warnings if the function appears anywhere in
the stack trace. This can hide a lot of unrelated warnings, especially
for a function like `_PyEval_EvalFrameDefault`, which is somewhere on
the stack more often than not.
Change all free-threaded suppressions to `race_top:`, which only matches
the top frame, and add any new suppressions this exposes.
(cherry picked from commit 98ff3f65c0232f31df89ebb52b244625ec9e3eb6)
Co-authored-by: Brett Simmers <swtaarrs@users.noreply.github.com>
|
|
|
|
|
|
|
|
|
|
| |
(GH-118292) (#118796)
Use relaxed atomics when reading / writing to the field. There are still a
few places in the GC where we do not use atomics. Those should be safe as
the world is stopped.
(cherry picked from commit cb6f75a32ca2649c6cc1cabb0301eb783efbd55b)
Co-authored-by: mpage <mpage@meta.com>
|
|
|
|
| |
This is only used by the specializing interpreter and the tier 2
optimizer, both of which are disabled in free-threaded builds.
|
| |
|
| |
|
|
|
|
| |
Fixup TSAN errors for dict
|
| |
|
|
|
|
| |
The load of `ob_ref_local races with stores. Using a relaxed load is
sufficient; stores to the field are relaxed.
|
|
|
| |
Use relaxed load to check if dictkeys are immortal
|
|
|
|
|
|
|
|
| |
Quiet erroneous TSAN reports of data races in `_PySeqLock`
TSAN reports a couple of data races between the compare/exchange in
`_PySeqLock_LockWrite` and the non-atomic loads in `_PySeqLock_{Abandon,Unlock}Write`.
This is another instance of TSAN incorrectly modeling failed compare/exchange
as a write instead of a load.
|
|
|
|
|
|
|
|
|
| |
Fix data races in the method cache in free-threaded builds
These are technically data races, but I think they're benign (to
the extent that that is actually possible). We update cache entries
non-atomically but read them atomically from another thread, and there's
nothing that establishes a happens-before relationship between the
reads and writes that I can see.
|
|
|
|
|
| |
Additionally, reduce the iterations for a few weakref tests that would
otherwise take a prohibitively long amount of time (> 1 hour) when TSAN
is enabled and the GIL is disabled.
|
|
|