Skip to content

Instantly share code, notes, and snippets.

@devdanzin
Last active July 17, 2026 17:04
Show Gist options
  • Select an option

  • Save devdanzin/0c3bea3347a169cb64f40873a6dcc3bd to your computer and use it in GitHub Desktop.

Select an option

Save devdanzin/0c3bea3347a169cb64f40873a6dcc3bd to your computer and use it in GitHub Desktop.
TSAN-0002: _zstd: ZstdCompressor.last_mode written plain under the lock but read lock-free via its Py_T_INT member descriptor

Data race: _zstd.ZstdCompressor.last_mode is written plain under the lock but read lock-free via its member descriptor (compressor.c:679)

ZstdCompressor.flush()/.compress() store the int last_mode field with a plain C write while holding self->lock (Modules/_zstd/compressor.c:679). The same field is exposed as a read-only Py_T_INT member, so getattr(c, "last_mode") reads it through PyMember_GetOne, which does a relaxed-atomic load (Python/structmember.c:64) and does not take self->lock. On a shared compressor, the unlocked plain write races the unlocked atomic read of last_mode. getattr and flush() both look thread-safe to callers, so a shared ZstdCompressor is not actually safe to use this way.

AI Disclaimer: this report was drafted by Claude Code, which also created and ran the reproducer; the maintainer reviewed and edited it.

Tracked in the umbrella issue python/cpython#153852 — one of a batch of free-threading data races found with fusil --tsan.

Summary

Modules/_zstd/compressor.c keeps a per-compressor int last_mode (the last compression end-directive used). It is mutated by compress() and flush() as a plain store, but only ever written under self->lock:

/* _zstd_ZstdCompressor_flush_impl */
PyMutex_Lock(&self->lock);
ret = compress_lock_held(self, NULL, mode);
if (ret) {
    self->last_mode = mode;            /* :679  plain write, lock held */
}
else {
    self->last_mode = ZSTD_e_end;      /* :682  plain write, lock held */
    ZSTD_CCtx_reset(self->cctx, ZSTD_reset_session_only);
}
PyMutex_Unlock(&self->lock);

The field is also published as a read-only member:

static PyMemberDef ZstdCompressor_members[] = {
    {"last_mode", Py_T_INT, offsetof(ZstdCompressor, last_mode),
     Py_READONLY, ZstdCompressor_last_mode_doc},   /* compressor.c:759 */
    {NULL}
};

Reading that attribute goes through PyMember_GetOne, which for Py_T_INT uses a relaxed atomic load and takes no object lock:

case Py_T_INT:
    v = PyLong_FromLong(FT_ATOMIC_LOAD_INT_RELAXED(*(int*)addr));  /* structmember.c:64 */
    break;

So on a shared ZstdCompressor, thread A doing c.flush() (plain, non-atomic write of last_mode, under the lock) races thread B doing getattr(c, "last_mode") (relaxed-atomic read, no lock). Because the writer's store is not atomic while the reader's load is, ThreadSanitizer reports a data race. It is value-benign (a single aligned 4-byte word holding one of a few enum constants), but it is a genuine reported race on operations callers treat as thread-safe.

Reproducer

import sys, threading
from compression import zstd
assert not sys._is_gil_enabled(), "run free-threaded: PYTHON_GIL=0"

NT = 8            # threads per shared compressor (even = flush/write, odd = read)
ROUNDS = 4000
pool = [None]
enter = threading.Barrier(NT + 1)
leave = threading.Barrier(NT + 1)

def worker(wid):
    for _ in range(ROUNDS):
        enter.wait()
        c = pool[0]
        if wid % 2 == 0:
            c.flush()                      # _zstd_ZstdCompressor_flush_impl: self->last_mode = mode
        else:
            for _ in range(16):
                getattr(c, "last_mode")    # PyMember_GetOne: relaxed-atomic read of last_mode
        leave.wait()

ts = [threading.Thread(target=worker, args=(w,)) for w in range(NT)]
for t in ts: t.start()
for r in range(ROUNDS):
    pool[0] = zstd.ZstdCompressor()        # fresh, unlocked compressor each round
    enter.wait()
    leave.wait()
for t in ts: t.join()
print("done, no crash")

Run (free-threaded + TSan build):

DEBUGINFOD_URLS= PYTHON_GIL=0 TSAN_OPTIONS="halt_on_error=1:symbolize=1:history_size=4" \
  setarch -R ./python repro.py

TSan report (confirmed, CPython 3.16.0a0 --disable-gil --with-thread-sanitizer, TSan build debug-ft-nojit-tsan)

WARNING: ThreadSanitizer: data race (pid=1963046)
  Write of size 4 at 0x7fffb6672500 by thread T1:
    #0 _zstd_ZstdCompressor_flush_impl Modules/_zstd/compressor.c:679:25   (self->last_mode = mode)
    #1 _zstd_ZstdCompressor_flush     Modules/_zstd/clinic/compressor.c.h:250:20
    #2 method_vectorcall_FASTCALL_KEYWORDS Objects/descrobject.c:421:24
    ...
    #29 thread_run Modules/_threadmodule.c:388:21

  Previous atomic read of size 4 at 0x7fffb6672500 by thread T8:
    #0 _Py_atomic_load_int_relaxed Include/cpython/pyatomic_gcc.h:307:10
    #1 PyMember_GetOne             Python/structmember.c:64:29   (FT_ATOMIC_LOAD_INT_RELAXED(*(int*)addr))
    #2 member_get                 Objects/descrobject.c:180:12
    #3 _PyObject_GenericGetAttrWithDict Objects/object.c:1926:19
    #4 PyObject_GenericGetAttr     Objects/object.c:2012:12
    #5 PyObject_GetAttr            Objects/object.c:1322:18
    #6 builtin_getattr             Python/bltinmodule.c:1331:18
    ...
    #29 thread_run Modules/_threadmodule.c:388:21

SUMMARY: ThreadSanitizer: data race Modules/_zstd/compressor.c:679:25 in _zstd_ZstdCompressor_flush_impl

Reproduces reliably (exit 66) across repeated runs and does not crash. The two racing functions match the seeded signature (_Py_atomic_load_int_relaxed in PyMember_GetOne vs _zstd_ZstdCompressor_flush_impl); TSan names whichever side it saw second in the one-line SUMMARY, so it may head with either function. (Note: compress() writes the same field at compressor.c:631/634 and produces the same race face.)

Root cause

last_mode is mutable internal state that CPython also publishes as a plain Py_T_INT member. In the free-threaded build, the generic member-read path (PyMember_GetOne) was hardened to use relaxed atomics (FT_ATOMIC_LOAD_INT_RELAXED, structmember.c:64) precisely so lock-free attribute reads are well-defined. The _zstd module, however, still writes last_mode with a plain C store (compressor.c:631, :634, :679, :682). self->lock serializes the writers against each other and against the internal read in set_pledged_input_size (:725, taken under the lock), but the member-descriptor read path never acquires self->lock, and a plain write paired with an atomic read is, by definition, a data race.

In other words, the object's own mutating methods and its published attribute disagree on the access discipline for last_mode: the read side is relaxed-atomic and lock-free; the write side is plain and lock-guarded. Those two disciplines are not compatible, and TSan flags the write/atomic-read pair.

Impact / severity

Low. last_mode is a naturally aligned 4-byte int holding one of three small enum constants (ZSTD_e_continue/ZSTD_e_flush/ZSTD_e_end). On the platforms CPython targets the store/load are single-word and not torn, so the observed value is always one of the valid constants — no crash, no use-after-free, no memory corruption. But it is a real, TSan-reported data race on APIs (getattr of a documented read-only attribute, and flush()/compress()) that callers reasonably assume are individually thread-safe, and it will show up as noise in any TSan run that touches a shared compressor. ZstdCompressor even documents itself as "Thread-safe at method level," which reading last_mode concurrently technically violates.

Suggested fix

Make the module's writes to last_mode use the matching relaxed atomic store so they pair cleanly with the relaxed-atomic member read (the value is idempotent enum state, so relaxed ordering is sufficient — this is exactly what the reader already uses):

/* replace plain `self->last_mode = X;` at compressor.c:631, 634, 679, 682 */
FT_ATOMIC_STORE_INT_RELAXED(self->last_mode, mode);        /* success paths */
FT_ATOMIC_STORE_INT_RELAXED(self->last_mode, ZSTD_e_end);  /* reset paths   */

(FT_ATOMIC_STORE_INT_RELAXED is the write counterpart of the FT_ATOMIC_LOAD_INT_RELAXED already used in structmember.c, defined in Include/internal/pycore_pyatomic_ft_wrappers.h.) The in-lock read at set_pledged_input_size (:725) can stay as-is (it is lock-protected against writers) or be switched to the atomic load for uniformity. No new lock is needed on the read path; the fix is purely to make the store atomic so it is well-defined against the existing lock-free member read.

Notes

Found by ThreadSanitizer fuzzing (fusil --tsan), fleet 01, module _zstd. This is the general "int/flag field mutated by a plain store but published as a Py_T_INT/Py_T_* member and read lock-free via PyMember_GetOne" class — the same shape can exist in any C type that both exposes a numeric member and mutates it at runtime. _zstd is new in 3.14; the member-read atomics landed as part of free-threading hardening, and the module-side stores were simply not converted to match. Worth a small upstream PR (make the four last_mode stores atomic); low priority given the benign value.


Part of an upcoming umbrella issue tracking free-threading data races found by fusil --tsan. Not yet individually filed.

import sys, threading
from compression import zstd
assert not sys._is_gil_enabled(), "run free-threaded: PYTHON_GIL=0"
# A ZstdCompressor exposes its `last_mode` field as a READ-ONLY Py_T_INT member.
# ZstdCompressor.flush()/.compress() write self->last_mode as a PLAIN C store while
# holding self->lock (Modules/_zstd/compressor.c:679). But getattr(c, "last_mode")
# reads that same int through PyMember_GetOne, which uses a RELAXED ATOMIC load
# (Python/structmember.c:64) and does NOT take self->lock. So on a shared compressor,
# a plain unlocked write races an unlocked atomic read of last_mode -> TSan data race.
#
# Writers call flush() (write at compressor.c:679); readers hammer getattr(c,"last_mode").
# Fresh compressor each round keeps the window tight and both operations valid.
NT = 8 # threads per shared compressor (even = flush/write, odd = read)
ROUNDS = 4000
pool = [None]
enter = threading.Barrier(NT + 1)
leave = threading.Barrier(NT + 1)
def worker(wid):
for _ in range(ROUNDS):
enter.wait()
c = pool[0]
if wid % 2 == 0:
c.flush() # _zstd_ZstdCompressor_flush_impl: self->last_mode = mode
else:
for _ in range(16):
getattr(c, "last_mode") # PyMember_GetOne: relaxed-atomic read of last_mode
leave.wait()
ts = [threading.Thread(target=worker, args=(w,)) for w in range(NT)]
for t in ts: t.start()
for r in range(ROUNDS):
pool[0] = zstd.ZstdCompressor() # fresh, unlocked compressor each round
enter.wait() # release the batch of workers onto the shared compressor
leave.wait() # wait for them to finish this batch
for t in ts: t.join()
print("done, no crash")
WARNING: ThreadSanitizer: data race (pid=1866410)
Atomic read of size 4 at 0x7fffb79799a0 by thread T8:
#0 _Py_atomic_load_int_relaxed Include/cpython/pyatomic_gcc.h:307:10 (python+0x6ad91c) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#1 PyMember_GetOne Python/structmember.c:64:29 (python+0x6ad91c)
#2 member_get Objects/descrobject.c:180:12 (python+0x2b39d5) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#3 _PyObject_GenericGetAttrWithDict Objects/object.c:1926:19 (python+0x380d25) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#4 PyObject_GenericGetAttr Objects/object.c:2012:12 (python+0x380a84) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#5 PyObject_GetAttr Objects/object.c:1322:18 (python+0x37fca5) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#6 builtin_getattr Python/bltinmodule.c:1331:18 (python+0x52c6dc) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#7 _Py_BuiltinCallFast_StackRef Python/ceval.c:817:11 (python+0x537113) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#8 _PyEval_EvalFrameDefault Python/generated_cases.c.h:2510:35 (python+0x54aafd) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#9 _PyEval_EvalFrame Include/internal/pycore_ceval.h:122:16 (python+0x53601c) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#10 _PyEval_Vector Python/ceval.c:2171:12 (python+0x53601c)
#11 _PyFunction_Vectorcall Objects/call.c (python+0x296ba6) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#12 _PyObject_VectorcallTstate Include/internal/pycore_call.h:144:11 (python+0x294b28) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#13 _PyObject_VectorcallPrepend Objects/call.c:855:20 (python+0x298682) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#14 method_vectorcall Objects/classobject.c:55:12 (python+0x29b26a) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#15 _PyObject_VectorcallTstate Include/internal/pycore_call.h:144:11 (python+0x5b472a) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#16 context_run Python/context.c:731:29 (python+0x5b472a)
#17 method_vectorcall_FASTCALL_KEYWORDS Objects/descrobject.c:421:24 (python+0x2b4ff6) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#18 _PyObject_VectorcallTstate Include/internal/pycore_call.h:144:11 (python+0x294b28) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#19 PyObject_Vectorcall Objects/call.c:327:12 (python+0x296660) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#20 _Py_VectorCallInstrumentation_StackRefSteal Python/ceval.c:768:11 (python+0x536b24) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#21 _PyEval_EvalFrameDefault Python/generated_cases.c.h:1906:35 (python+0x5662d0) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#22 _PyEval_EvalFrame Include/internal/pycore_ceval.h:122:16 (python+0x53601c) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#23 _PyEval_Vector Python/ceval.c:2171:12 (python+0x53601c)
#24 _PyFunction_Vectorcall Objects/call.c (python+0x296ba6) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#25 _PyObject_VectorcallTstate Include/internal/pycore_call.h:144:11 (python+0x294b28) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#26 _PyObject_VectorcallPrepend Objects/call.c:855:20 (python+0x298682) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#27 method_vectorcall Objects/classobject.c:55:12 (python+0x29b26a) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#28 _PyVectorcall_Call Objects/call.c:273:16 (python+0x296512) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#29 _PyObject_Call Objects/call.c:348:16 (python+0x296785) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#30 PyObject_Call Objects/call.c:373:12 (python+0x2969a7) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#31 thread_run Modules/_threadmodule.c:388:21 (python+0x7e0778) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#32 pythread_wrapper Python/thread_pthread.h:234:5 (python+0x6cd55b) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
Previous write of size 4 at 0x7fffb79799a0 by thread T7:
#0 _zstd_ZstdCompressor_flush_impl Modules/_zstd/compressor.c:679:25 (_zstd.cpython-316td-x86_64-linux-gnu.so+0x9aac) (BuildId: d0b4b184dd4e32ff329e267caa7bec697444c113)
#1 _zstd_ZstdCompressor_flush Modules/_zstd/clinic/compressor.c.h:250:20 (_zstd.cpython-316td-x86_64-linux-gnu.so+0x9aac)
#2 cfunction_vectorcall_FASTCALL_KEYWORDS Objects/methodobject.c:465:24 (python+0x36f922) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#3 _PyVectorcall_Call Objects/call.c:273:16 (python+0x296512) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#4 _PyObject_Call Objects/call.c:348:16 (python+0x296785) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#5 PyObject_Call Objects/call.c:373:12 (python+0x2969a7) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#6 _PyEval_EvalFrameDefault Python/generated_cases.c.h:2831:38 (python+0x55aea6) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#7 _PyEval_EvalFrame Include/internal/pycore_ceval.h:122:16 (python+0x53601c) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#8 _PyEval_Vector Python/ceval.c:2171:12 (python+0x53601c)
#9 _PyFunction_Vectorcall Objects/call.c (python+0x296ba6) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#10 _PyObject_VectorcallTstate Include/internal/pycore_call.h:144:11 (python+0x294b28) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#11 _PyObject_VectorcallPrepend Objects/call.c:855:20 (python+0x298682) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#12 method_vectorcall Objects/classobject.c:55:12 (python+0x29b26a) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#13 _PyObject_VectorcallTstate Include/internal/pycore_call.h:144:11 (python+0x5b472a) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#14 context_run Python/context.c:731:29 (python+0x5b472a)
#15 method_vectorcall_FASTCALL_KEYWORDS Objects/descrobject.c:421:24 (python+0x2b4ff6) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#16 _PyObject_VectorcallTstate Include/internal/pycore_call.h:144:11 (python+0x294b28) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#17 PyObject_Vectorcall Objects/call.c:327:12 (python+0x296660) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#18 _Py_VectorCallInstrumentation_StackRefSteal Python/ceval.c:768:11 (python+0x536b24) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#19 _PyEval_EvalFrameDefault Python/generated_cases.c.h:1906:35 (python+0x5662d0) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#20 _PyEval_EvalFrame Include/internal/pycore_ceval.h:122:16 (python+0x53601c) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#21 _PyEval_Vector Python/ceval.c:2171:12 (python+0x53601c)
#22 _PyFunction_Vectorcall Objects/call.c (python+0x296ba6) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#23 _PyObject_VectorcallTstate Include/internal/pycore_call.h:144:11 (python+0x294b28) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#24 _PyObject_VectorcallPrepend Objects/call.c:855:20 (python+0x298682) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#25 method_vectorcall Objects/classobject.c:55:12 (python+0x29b26a) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#26 _PyVectorcall_Call Objects/call.c:273:16 (python+0x296512) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#27 _PyObject_Call Objects/call.c:348:16 (python+0x296785) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#28 PyObject_Call Objects/call.c:373:12 (python+0x2969a7) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#29 thread_run Modules/_threadmodule.c:388:21 (python+0x7e0778) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#30 pythread_wrapper Python/thread_pthread.h:234:5 (python+0x6cd55b) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
Thread T8 'tsan_1_3' (tid=1866434, running) created by main thread at:
#0 pthread_create <null> (python+0xfff0e) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#1 do_start_joinable_thread Python/thread_pthread.h:281:14 (python+0x6cc22b) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#2 PyThread_start_joinable_thread Python/thread_pthread.h:323:9 (python+0x6cc024) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#3 ThreadHandle_start Modules/_threadmodule.c:475:9 (python+0x7e0237) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#4 do_start_new_thread Modules/_threadmodule.c:1919:9 (python+0x7e0237)
#5 thread_PyThread_start_joinable_thread Modules/_threadmodule.c:2042:14 (python+0x7de480) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#6 cfunction_call Objects/methodobject.c:564:18 (python+0x370f23) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#7 _PyObject_MakeTpCall Objects/call.c:242:18 (python+0x29522c) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#8 _PyObject_VectorcallTstate Include/internal/pycore_call.h:142:16 (python+0x294b69) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#9 PyObject_Vectorcall Objects/call.c:327:12 (python+0x296660) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#10 _Py_VectorCall_StackRefSteal Python/ceval.c:726:11 (python+0x53636b) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#11 _PyEval_EvalFrameDefault Python/generated_cases.c.h:3686:35 (python+0x54f032) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#12 _PyEval_EvalFrame Include/internal/pycore_ceval.h:122:16 (python+0x53601c) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#13 _PyEval_Vector Python/ceval.c:2171:12 (python+0x53601c)
#14 PyEval_EvalCode Python/ceval.c:679:21 (python+0x5358a1) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#15 run_eval_code_obj Python/pythonrun.c:1369:12 (python+0x69ef1f) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#16 run_mod Python/pythonrun.c:1472:19 (python+0x69eab2) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#17 pyrun_file Python/pythonrun.c:1296:15 (python+0x69a4e1) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#18 _PyRun_SimpleFileObject Python/pythonrun.c:518:13 (python+0x698aca) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#19 _PyRun_AnyFileObject Python/pythonrun.c:81:15 (python+0x6981a6) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#20 pymain_run_file_obj Modules/main.c:411:15 (python+0x6ee3ad) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#21 pymain_run_file Modules/main.c:430:15 (python+0x6ee3ad)
#22 pymain_run_python Modules/main.c:715:21 (python+0x6ed206) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#23 Py_RunMain Modules/main.c:796:5 (python+0x6ed206)
#24 pymain_main Modules/main.c:826:12 (python+0x6ed977) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#25 Py_BytesMain Modules/main.c:850:12 (python+0x6eda24) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#26 main Programs/python.c:15:12 (python+0x184cc0) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
Thread T7 'tsan_1_2' (tid=1866433, running) created by main thread at:
#0 pthread_create <null> (python+0xfff0e) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#1 do_start_joinable_thread Python/thread_pthread.h:281:14 (python+0x6cc22b) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#2 PyThread_start_joinable_thread Python/thread_pthread.h:323:9 (python+0x6cc024) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#3 ThreadHandle_start Modules/_threadmodule.c:475:9 (python+0x7e0237) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#4 do_start_new_thread Modules/_threadmodule.c:1919:9 (python+0x7e0237)
#5 thread_PyThread_start_joinable_thread Modules/_threadmodule.c:2042:14 (python+0x7de480) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#6 cfunction_call Objects/methodobject.c:564:18 (python+0x370f23) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#7 _PyObject_MakeTpCall Objects/call.c:242:18 (python+0x29522c) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#8 _PyObject_VectorcallTstate Include/internal/pycore_call.h:142:16 (python+0x294b69) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#9 PyObject_Vectorcall Objects/call.c:327:12 (python+0x296660) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#10 _Py_VectorCall_StackRefSteal Python/ceval.c:726:11 (python+0x53636b) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#11 _PyEval_EvalFrameDefault Python/generated_cases.c.h:3686:35 (python+0x54f032) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#12 _PyEval_EvalFrame Include/internal/pycore_ceval.h:122:16 (python+0x53601c) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#13 _PyEval_Vector Python/ceval.c:2171:12 (python+0x53601c)
#14 PyEval_EvalCode Python/ceval.c:679:21 (python+0x5358a1) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#15 run_eval_code_obj Python/pythonrun.c:1369:12 (python+0x69ef1f) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#16 run_mod Python/pythonrun.c:1472:19 (python+0x69eab2) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#17 pyrun_file Python/pythonrun.c:1296:15 (python+0x69a4e1) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#18 _PyRun_SimpleFileObject Python/pythonrun.c:518:13 (python+0x698aca) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#19 _PyRun_AnyFileObject Python/pythonrun.c:81:15 (python+0x6981a6) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#20 pymain_run_file_obj Modules/main.c:411:15 (python+0x6ee3ad) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#21 pymain_run_file Modules/main.c:430:15 (python+0x6ee3ad)
#22 pymain_run_python Modules/main.c:715:21 (python+0x6ed206) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#23 Py_RunMain Modules/main.c:796:5 (python+0x6ed206)
#24 pymain_main Modules/main.c:826:12 (python+0x6ed977) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#25 Py_BytesMain Modules/main.c:850:12 (python+0x6eda24) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#26 main Programs/python.c:15:12 (python+0x184cc0) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
SUMMARY: ThreadSanitizer: data race Include/cpython/pyatomic_gcc.h:307:10 in _Py_atomic_load_int_relaxed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment