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/6b99ef6dce08ac64d8d1d379308a8f86 to your computer and use it in GitHub Desktop.

Select an option

Save devdanzin/6b99ef6dce08ac64d8d1d379308a8f86 to your computer and use it in GitHub Desktop.
TSAN-0018: dict: readers of dk_nentries use plain loads instead of the existing LOAD_KEYS_NENTRIES macro, racing the atomic bump (object.__getstate__, dict.clear, and the public PyDict_Next)

Data race: object.__getstate__ reads a type's shared-keys dk_nentries non-atomically while setattr atomically bumps it (dictobject.c:7666 vs :248)

_PyObject_IsInstanceDictEmpty (reached from object.__getstate__ / pickle / copy) iterates a type's shared-keys with the plain loop bound i < keys->dk_nentries. Another thread adding a new attribute name via setattr inserts a key into those same shared keys and bumps dk_nentries with an atomic store (split_keys_entry_added). The writer was deliberately made atomic "when we're racing with reads", but this reader forgot the matching atomic load — so pickling/copying an object while another thread sets an attribute is a TSan data race on the type's dk_nentries.

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

On the free-threaded build, instances of an ordinary class store their attributes in inline values backed by the type's shared keys object (CACHED_KEYS(tp)). Two unsynchronized accesses to that shared keys object's dk_nentries field race:

  • Write (atomic): setattr(obj, new_name, v) where new_name is seen for the first time by the type inserts a key into the shared keys and calls split_keys_entry_added(), which does _Py_atomic_store_ssize_relaxed(&keys->dk_nentries, keys->dk_nentries + 1) (Objects/dictobject.c:248).
  • Read (plain): object.__getstate__() — used by pickle, copy, and shelve — calls object_getstate_default → _PyObject_IsInstanceDictEmpty(obj), which loops for (i = 0; i < keys->dk_nentries; i++) (Objects/dictobject.c:7666) with a non-atomic read.

Because the shared keys belong to the type, the two threads don't even need the same instance — same class + a genuinely new attribute name is enough. The race is value-benign (single aligned word, monotonically increasing, per-slot value reads are already atomic), but it is a real TSan-reported data race on operations (pickle.dumps / copy.copy / obj.__getstate__()) that callers treat as read-only.

Reproducer

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

NR = 3                                  # reader threads: getstate (plain read of dk_nentries)
NW = 3                                  # writer threads: setattr new keys (atomic write)
ROUNDS = 3000
NAMES = ["a%d" % i for i in range(20)]  # < SHARED_KEYS_MAX_SIZE (30): stays split/inline-values

box = [None]
enter = threading.Barrier(NR + NW + 1)
leave = threading.Barrier(NR + NW + 1)

def reader():
    for _ in range(ROUNDS):
        enter.wait()
        obj = box[0]
        for _ in range(40):
            obj.__getstate__()          # -> object_getstate_default -> _PyObject_IsInstanceDictEmpty
        leave.wait()

def writer():
    for _ in range(ROUNDS):
        enter.wait()
        obj = box[0]
        for n in NAMES:
            setattr(obj, n, 1)          # first touch of a new name -> split_keys_entry_added
        leave.wait()

threads = ([threading.Thread(target=reader) for _ in range(NR)] +
           [threading.Thread(target=writer) for _ in range(NW)])
for t in threads:
    t.start()

for r in range(ROUNDS):
    C = type("C%d" % r, (), {})         # fresh type => fresh shared keys (dk_nentries grows from 0)
    box[0] = C()
    enter.wait()
    leave.wait()
for t in threads:
    t.join()
print("done, no crash")

The shelve fleet vehicle that seeded this did essentially the same thing: it hammered pickle.dumps on an object while a thread ran setattr(_obj, "_tsan_a%d" % (_i % 4), _i). Using a fresh type each round (so dk_nentries starts at 0 and grows during the round) makes the first-touch insertion window hit reliably.

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, heads/main:bcf98ddbc40)

WARNING: ThreadSanitizer: data race (pid=2150454)
  Atomic write of size 8 at 0x7fffb6867e28 by thread T5:
    #0 _Py_atomic_store_ssize_relaxed  Include/cpython/pyatomic_gcc.h:513:3
    #1 split_keys_entry_added          Objects/dictobject.c:248:5
    #2 insert_split_key                Objects/dictobject.c:1940:9
    #3 store_instance_attr_lock_held   Objects/dictobject.c:7396:14
    #4 _PyObject_StoreInstanceAttribute Objects/dictobject.c:7528:19
    #5 _PyObject_GenericSetAttrWithDict Objects/object.c:2058:19
    ... PyObject_SetAttr -> builtin_setattr (setattr(obj, name, value))

  Previous read of size 8 at 0x7fffb6867e28 by thread T2:
    #0 _PyObject_IsInstanceDictEmpty   Objects/dictobject.c        (loop bound :7666)
    #1 object_getstate_default         Objects/typeobject.c:7928:9
    #2 object___getstate___impl        Objects/typeobject.c:8079:12
    ... object.__getstate__()   (also reached via pickle reduce_newobj / copy)

SUMMARY: ThreadSanitizer: data race Include/cpython/pyatomic_gcc.h:513:3 in _Py_atomic_store_ssize_relaxed

Reproduces deterministically (exit 66) within a few seconds, no crash. Across runs TSan may print the SUMMARY in terms of either side (_Py_atomic_store_ssize_relaxed or _PyObject_IsInstanceDictEmpty) — it is the same read/write pair on the same word. The confirmed signature matches the seeded one (same two racing functions; the seed reached the read via pickle.dumps→reduce_newobj→object_getstate, this repro reaches it via the direct object.__getstate__() C method, which is the identical object_getstate_default path).

Root cause

Objects/dictobject.c, the writer, is deliberately atomic and even documents the read-race it is guarding against:

static inline void split_keys_entry_added(PyDictKeysObject *keys)
{
    ASSERT_KEYS_LOCKED(keys);
    // We increase before we decrease so we never get too small of a value
    // when we're racing with reads
    _Py_atomic_store_ssize_relaxed(&keys->dk_nentries, keys->dk_nentries + 1);   // :248
    _Py_atomic_store_ssize_release(&keys->dk_usable, keys->dk_usable - 1);
}

The reader, in the same file, reads that field with a plain load:

_PyObject_IsInstanceDictEmpty(PyObject *obj)
{
    ...
    if (tp->tp_flags & Py_TPFLAGS_INLINE_VALUES) {
        PyDictValues *values = _PyObject_InlineValues(obj);
        if (FT_ATOMIC_LOAD_UINT8(values->valid)) {
            PyDictKeysObject *keys = CACHED_KEYS(tp);
            for (Py_ssize_t i = 0; i < keys->dk_nentries; i++) {          // :7666  PLAIN read (racy)
                if (FT_ATOMIC_LOAD_PTR_RELAXED(values->values[i]) != NULL) { // per-slot read already atomic
                    return 0;
                }
            }
            return 1;
        }
        ...

The file already defines the correct accessor for exactly this field and uses it elsewhere:

#define LOAD_KEYS_NENTRIES(keys) _Py_atomic_load_ssize_relaxed(&keys->dk_nentries)   // :237
...
for (i = 0; i < LOAD_KEYS_NENTRIES(a->ma_keys); i++) {   // dict_equal, :4632 — the correct idiom

So this is a plain missed-atomic-load: the loop bound at :7666 should go through LOAD_KEYS_NENTRIES. dk_nentries on shared keys is monotonically increasing and the write side already orders dk_usable (release) after it, so a relaxed load is sufficient — the read may observe a value one step stale or ahead, but the inline values array is capacity-sized to the shared keys and each values->values[i] read is already FT_ATOMIC_LOAD_PTR_RELAXED, so there is no out-of-bounds and no torn pointer.

Impact / severity

Low. Value-benign, crash-free data race:

  • dk_nentries is a single aligned Py_ssize_t; the store is a single word and the value only grows, so the reader can only read a slightly stale/ahead count.
  • The subsequent per-slot access uses an atomic load and stays within the capacity-sized inline values array, so there is no use-after-free or OOB.

But it is a genuine, easily-triggered TSan data race on pickle.dumps / copy.copy / obj.__getstate__() — operations user code reasonably treats as read-only and thread-safe on a shared object. Under -fsanitize=thread (or a future stricter memory model) it is undefined behavior and pollutes TSan runs of any code that pickles/copies objects concurrently with attribute mutation.

Real bug vs. expected

Real CPython free-threading bug, in scope. This is not "don't share an object across threads": the write side (split_keys_entry_added) was specifically made atomic with a comment about racing with reads, and reading an object's state (pickle/copy) concurrently with setattr is a normal method race (unlike concurrent __init__/construction, cf. cpython#127192, which is out of scope). The reader in _PyObject_IsInstanceDictEmpty simply omitted the matching LOAD_KEYS_NENTRIES. Worth filing.

Suggested fix

Use the existing relaxed-atomic accessor for the loop bound in _PyObject_IsInstanceDictEmpty:

    PyDictKeysObject *keys = CACHED_KEYS(tp);
    for (Py_ssize_t i = 0; i < LOAD_KEYS_NENTRIES(keys); i++) {   // was: keys->dk_nentries
        if (FT_ATOMIC_LOAD_PTR_RELAXED(values->values[i]) != NULL) {
            return 0;
        }
    }

(LOAD_KEYS_NENTRIES is _Py_atomic_load_ssize_relaxed(&keys->dk_nentries) under Py_GIL_DISABLED and a plain read on the default build, so the non-free-threaded build is unaffected.)

Notes

Found by ThreadSanitizer fuzzing (fusil --tsan); vehicle module shelve. The same shared-keys dk_nentries field is read in several places; any that iterate it with a plain keys->dk_nentries (rather than LOAD_KEYS_NENTRIES) while a concurrent setattr can add new keys are candidates for the same race and should be audited (e.g. other inline-values / split-dict iteration helpers). Resembles the known free-threading class of "writer made atomic, one reader missed the matching atomic load" rather than a distinct algorithmic bug.


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

import sys, threading
assert not sys._is_gil_enabled(), "run free-threaded: PYTHON_GIL=0"
# object.__getstate__() (object_getstate_default, used by pickle/copy/shelve) calls
# _PyObject_IsInstanceDictEmpty(obj), which reads the type's shared-keys dk_nentries as a
# PLAIN (non-atomic) loop bound: for (i = 0; i < keys->dk_nentries; i++).
# Meanwhile setattr(obj, NEW_NAME, v) inserts a key into those same shared keys and bumps
# dk_nentries via split_keys_entry_added() -> _Py_atomic_store_ssize_relaxed (an ATOMIC store).
# Reader (plain load) vs writer (atomic store) on the same word => TSan data race.
#
# The shared keys belong to the TYPE, so a fresh class each round gives fresh keys whose
# dk_nentries starts at 0 and grows as new attribute names are first inserted -- that first
# insertion is the racing write window.
NR = 3 # reader threads: getstate (plain read of dk_nentries)
NW = 3 # writer threads: setattr new keys (atomic write)
ROUNDS = 3000
NAMES = ["a%d" % i for i in range(20)] # < SHARED_KEYS_MAX_SIZE (30): stays split/inline-values
box = [None]
enter = threading.Barrier(NR + NW + 1)
leave = threading.Barrier(NR + NW + 1)
def reader():
for _ in range(ROUNDS):
enter.wait()
obj = box[0]
for _ in range(40):
obj.__getstate__() # -> object_getstate_default -> _PyObject_IsInstanceDictEmpty
leave.wait()
def writer():
for _ in range(ROUNDS):
enter.wait()
obj = box[0]
for n in NAMES:
setattr(obj, n, 1) # first touch of a new name -> split_keys_entry_added
leave.wait()
threads = ([threading.Thread(target=reader) for _ in range(NR)] +
[threading.Thread(target=writer) for _ in range(NW)])
for t in threads:
t.start()
for r in range(ROUNDS):
C = type("C%d" % r, (), {}) # fresh type => fresh shared keys (dk_nentries grows from 0)
box[0] = C()
enter.wait() # release workers onto the fresh object
leave.wait() # wait for them to finish this round
for t in threads:
t.join()
print("done, no crash")
WARNING: ThreadSanitizer: data race (pid=2114477)
Atomic write of size 8 at 0x7fffb77473a8 by thread T2:
#0 _Py_atomic_store_ssize_relaxed /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/./Include/cpython/pyatomic_gcc.h:513:3 (python+0x34aa17) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#1 split_keys_entry_added /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/Objects/dictobject.c:248:5 (python+0x34aa17)
#2 insert_split_key /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/Objects/dictobject.c:1940:9 (python+0x34aa17)
#3 store_instance_attr_lock_held /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/Objects/dictobject.c:7396:14 (python+0x34c216) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#4 store_instance_attr_dict /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/Objects/dictobject.c:7483:15 (python+0x34bf2f) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#5 _PyObject_StoreInstanceAttribute /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/Objects/dictobject.c (python+0x34b8d9) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#6 _PyObject_GenericSetAttrWithDict /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/Objects/object.c:2058:19 (python+0x382e05) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#7 PyObject_GenericSetAttr /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/Objects/object.c:2120:12 (python+0x38333b) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#8 PyObject_SetAttr /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/Objects/object.c:1533:15 (python+0x380341) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#9 builtin_setattr_impl /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/Python/bltinmodule.c:1820:9 (python+0x52f22d) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#10 builtin_setattr /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/Python/clinic/bltinmodule.c.h:789:20 (python+0x52f22d)
#11 cfunction_vectorcall_FASTCALL /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/Objects/methodobject.c:449:24 (python+0x36f762) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#12 _PyObject_VectorcallTstate /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/./Include/internal/pycore_call.h:144:11 (python+0x294b28) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#13 PyObject_Vectorcall /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/Objects/call.c:327:12 (python+0x296660) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#14 _Py_VectorCallInstrumentation_StackRefSteal /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/Python/ceval.c:768:11 (python+0x536b24) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#15 _PyEval_EvalFrameDefault /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/Python/generated_cases.c.h:1906:35 (python+0x5662d0) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#16 _PyEval_EvalFrame /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/./Include/internal/pycore_ceval.h:122:16 (python+0x53601c) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#17 _PyEval_Vector /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/Python/ceval.c:2171:12 (python+0x53601c)
#18 _PyFunction_Vectorcall /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/Objects/call.c (python+0x296ba6) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#19 _PyObject_VectorcallTstate /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/./Include/internal/pycore_call.h:144:11 (python+0x294b28) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#20 _PyObject_VectorcallPrepend /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/Objects/call.c:855:20 (python+0x298682) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#21 method_vectorcall /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/Objects/classobject.c:55:12 (python+0x29b26a) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#22 _PyObject_VectorcallTstate /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/./Include/internal/pycore_call.h:144:11 (python+0x5b472a) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#23 context_run /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/Python/context.c:731:29 (python+0x5b472a)
#24 method_vectorcall_FASTCALL_KEYWORDS /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/Objects/descrobject.c:421:24 (python+0x2b4ff6) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#25 _PyObject_VectorcallTstate /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/./Include/internal/pycore_call.h:144:11 (python+0x294b28) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#26 PyObject_Vectorcall /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/Objects/call.c:327:12 (python+0x296660) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#27 _Py_VectorCallInstrumentation_StackRefSteal /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/Python/ceval.c:768:11 (python+0x536b24) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#28 _PyEval_EvalFrameDefault /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/Python/generated_cases.c.h:1906:35 (python+0x5662d0) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#29 _PyEval_EvalFrame /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/./Include/internal/pycore_ceval.h:122:16 (python+0x53601c) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#30 _PyEval_Vector /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/Python/ceval.c:2171:12 (python+0x53601c)
#31 _PyFunction_Vectorcall /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/Objects/call.c (python+0x296ba6) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#32 _PyObject_VectorcallTstate /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/./Include/internal/pycore_call.h:144:11 (python+0x294b28) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#33 _PyObject_VectorcallPrepend /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/Objects/call.c:855:20 (python+0x298682) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#34 method_vectorcall /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/Objects/classobject.c:55:12 (python+0x29b26a) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#35 _PyVectorcall_Call /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/Objects/call.c:273:16 (python+0x296512) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#36 _PyObject_Call /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/Objects/call.c:348:16 (python+0x296785) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#37 PyObject_Call /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/Objects/call.c:373:12 (python+0x2969a7) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#38 thread_run /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/./Modules/_threadmodule.c:388:21 (python+0x7e0778) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#39 pythread_wrapper /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/Python/thread_pthread.h:234:5 (python+0x6cd55b) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
Previous read of size 8 at 0x7fffb77473a8 by thread T1:
#0 _PyObject_IsInstanceDictEmpty /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/Objects/dictobject.c (python+0x34d38a) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#1 object_getstate_default /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/Objects/typeobject.c:7928:9 (python+0x40a114) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#2 object_getstate /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/Objects/typeobject.c:8054:17 (python+0x3f1a6f) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#3 reduce_newobj /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/Objects/typeobject.c:8289:13 (python+0x40d408) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#4 _common_reduce /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/Objects/typeobject.c:8332:16 (python+0x40d408)
#5 object___reduce_ex___impl /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/Objects/typeobject.c:8397:12 (python+0x40b7e3) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#6 object___reduce_ex__ /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/Objects/clinic/typeobject.c.h:193:20 (python+0x40b7e3)
#7 cfunction_vectorcall_O /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/Objects/methodobject.c:536:24 (python+0x36fec2) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#8 _PyObject_VectorcallTstate /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/./Include/internal/pycore_call.h:144:11 (python+0x294b28) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#9 PyObject_CallOneArg /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/Objects/call.c:395:12 (python+0x296a8c) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#10 _Pickle_FastCall /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/./Modules/_pickle.c:404:14 (_pickle.cpython-316td-x86_64-linux-gnu.so+0x10777) (BuildId: b5c4ed67dbbed49db1cef9691a5dda0cb8520753)
#11 save /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/./Modules/_pickle.c:4719:32 (_pickle.cpython-316td-x86_64-linux-gnu.so+0xa04f) (BuildId: b5c4ed67dbbed49db1cef9691a5dda0cb8520753)
#12 dump /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/./Modules/_pickle.c:4817:9 (_pickle.cpython-316td-x86_64-linux-gnu.so+0x85c7) (BuildId: b5c4ed67dbbed49db1cef9691a5dda0cb8520753)
#13 _pickle_dumps_impl /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/./Modules/_pickle.c:8024:9 (_pickle.cpython-316td-x86_64-linux-gnu.so+0x6b72) (BuildId: b5c4ed67dbbed49db1cef9691a5dda0cb8520753)
#14 _pickle_dumps /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/./Modules/clinic/_pickle.c.h:829:20 (_pickle.cpython-316td-x86_64-linux-gnu.so+0x6b72)
#15 cfunction_vectorcall_FASTCALL_KEYWORDS /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/Objects/methodobject.c:465:24 (python+0x36f922) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#16 _PyObject_VectorcallTstate /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/./Include/internal/pycore_call.h:144:11 (python+0x294b28) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#17 PyObject_Vectorcall /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/Objects/call.c:327:12 (python+0x296660) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#18 _Py_VectorCallInstrumentation_StackRefSteal /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/Python/ceval.c:768:11 (python+0x536b24) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#19 _PyEval_EvalFrameDefault /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/Python/generated_cases.c.h:1906:35 (python+0x5662d0) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#20 _PyEval_EvalFrame /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/./Include/internal/pycore_ceval.h:122:16 (python+0x53601c) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#21 _PyEval_Vector /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/Python/ceval.c:2171:12 (python+0x53601c)
#22 _PyFunction_Vectorcall /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/Objects/call.c (python+0x296ba6) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#23 _PyObject_VectorcallTstate /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/./Include/internal/pycore_call.h:144:11 (python+0x294b28) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#24 _PyObject_VectorcallPrepend /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/Objects/call.c:855:20 (python+0x298682) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#25 method_vectorcall /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/Objects/classobject.c:55:12 (python+0x29b26a) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#26 _PyObject_VectorcallTstate /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/./Include/internal/pycore_call.h:144:11 (python+0x5b472a) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#27 context_run /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/Python/context.c:731:29 (python+0x5b472a)
#28 method_vectorcall_FASTCALL_KEYWORDS /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/Objects/descrobject.c:421:24 (python+0x2b4ff6) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#29 _PyObject_VectorcallTstate /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/./Include/internal/pycore_call.h:144:11 (python+0x294b28) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#30 PyObject_Vectorcall /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/Objects/call.c:327:12 (python+0x296660) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#31 _Py_VectorCallInstrumentation_StackRefSteal /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/Python/ceval.c:768:11 (python+0x536b24) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#32 _PyEval_EvalFrameDefault /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/Python/generated_cases.c.h:1906:35 (python+0x5662d0) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#33 _PyEval_EvalFrame /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/./Include/internal/pycore_ceval.h:122:16 (python+0x53601c) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#34 _PyEval_Vector /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/Python/ceval.c:2171:12 (python+0x53601c)
#35 _PyFunction_Vectorcall /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/Objects/call.c (python+0x296ba6) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#36 _PyObject_VectorcallTstate /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/./Include/internal/pycore_call.h:144:11 (python+0x294b28) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#37 _PyObject_VectorcallPrepend /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/Objects/call.c:855:20 (python+0x298682) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#38 method_vectorcall /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/Objects/classobject.c:55:12 (python+0x29b26a) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#39 _PyVectorcall_Call /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/Objects/call.c:273:16 (python+0x296512) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#40 _PyObject_Call /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/Objects/call.c:348:16 (python+0x296785) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#41 PyObject_Call /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/Objects/call.c:373:12 (python+0x2969a7) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#42 thread_run /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/./Modules/_threadmodule.c:388:21 (python+0x7e0778) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#43 pythread_wrapper /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/Python/thread_pthread.h:234:5 (python+0x6cd55b) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
Thread T2 'tsan_0_1' (tid=2114553, running) created by main thread at:
#0 pthread_create <null> (python+0xfff0e) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#1 do_start_joinable_thread /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/Python/thread_pthread.h:281:14 (python+0x6cc22b) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#2 PyThread_start_joinable_thread /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/Python/thread_pthread.h:323:9 (python+0x6cc024) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#3 ThreadHandle_start /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/./Modules/_threadmodule.c:475:9 (python+0x7e0237) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#4 do_start_new_thread /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/./Modules/_threadmodule.c:1919:9 (python+0x7e0237)
#5 thread_PyThread_start_joinable_thread /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/./Modules/_threadmodule.c:2042:14 (python+0x7de480) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#6 cfunction_call /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/Objects/methodobject.c:564:18 (python+0x370f23) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#7 _PyObject_MakeTpCall /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/Objects/call.c:242:18 (python+0x29522c) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#8 _PyObject_VectorcallTstate /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/./Include/internal/pycore_call.h:142:16 (python+0x294b69) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#9 PyObject_Vectorcall /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/Objects/call.c:327:12 (python+0x296660) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#10 _Py_VectorCall_StackRefSteal /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/Python/ceval.c:726:11 (python+0x53636b) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#11 _PyEval_EvalFrameDefault /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/Python/generated_cases.c.h:3686:35 (python+0x54f032) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#12 _PyEval_EvalFrame /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/./Include/internal/pycore_ceval.h:122:16 (python+0x53601c) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#13 _PyEval_Vector /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/Python/ceval.c:2171:12 (python+0x53601c)
#14 PyEval_EvalCode /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/Python/ceval.c:679:21 (python+0x5358a1) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#15 run_eval_code_obj /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/Python/pythonrun.c:1369:12 (python+0x69ef1f) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#16 run_mod /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/Python/pythonrun.c:1472:19 (python+0x69eab2) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#17 pyrun_file /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/Python/pythonrun.c:1296:15 (python+0x69a4e1) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#18 _PyRun_SimpleFileObject /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/Python/pythonrun.c:518:13 (python+0x698aca) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#19 _PyRun_AnyFileObject /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/Python/pythonrun.c:81:15 (python+0x6981a6) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#20 pymain_run_file_obj /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/Modules/main.c:411:15 (python+0x6ee3ad) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#21 pymain_run_file /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/Modules/main.c:430:15 (python+0x6ee3ad)
#22 pymain_run_python /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/Modules/main.c:715:21 (python+0x6ed206) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#23 Py_RunMain /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/Modules/main.c:796:5 (python+0x6ed206)
#24 pymain_main /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/Modules/main.c:826:12 (python+0x6ed977) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#25 Py_BytesMain /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/Modules/main.c:850:12 (python+0x6eda24) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#26 main /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/./Programs/python.c:15:12 (python+0x184cc0) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
Thread T1 'tsan_0_0' (tid=2114552, running) created by main thread at:
#0 pthread_create <null> (python+0xfff0e) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#1 do_start_joinable_thread /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/Python/thread_pthread.h:281:14 (python+0x6cc22b) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#2 PyThread_start_joinable_thread /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/Python/thread_pthread.h:323:9 (python+0x6cc024) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#3 ThreadHandle_start /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/./Modules/_threadmodule.c:475:9 (python+0x7e0237) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#4 do_start_new_thread /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/./Modules/_threadmodule.c:1919:9 (python+0x7e0237)
#5 thread_PyThread_start_joinable_thread /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/./Modules/_threadmodule.c:2042:14 (python+0x7de480) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#6 cfunction_call /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/Objects/methodobject.c:564:18 (python+0x370f23) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#7 _PyObject_MakeTpCall /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/Objects/call.c:242:18 (python+0x29522c) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#8 _PyObject_VectorcallTstate /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/./Include/internal/pycore_call.h:142:16 (python+0x294b69) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#9 PyObject_Vectorcall /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/Objects/call.c:327:12 (python+0x296660) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#10 _Py_VectorCallInstrumentation_StackRefSteal /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/Python/ceval.c:768:11 (python+0x536b24) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#11 _PyEval_EvalFrameDefault /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/Python/generated_cases.c.h:3474:35 (python+0x562e75) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#12 _PyEval_EvalFrame /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/./Include/internal/pycore_ceval.h:122:16 (python+0x53601c) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#13 _PyEval_Vector /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/Python/ceval.c:2171:12 (python+0x53601c)
#14 PyEval_EvalCode /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/Python/ceval.c:679:21 (python+0x5358a1) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#15 run_eval_code_obj /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/Python/pythonrun.c:1369:12 (python+0x69ef1f) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#16 run_mod /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/Python/pythonrun.c:1472:19 (python+0x69eab2) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#17 pyrun_file /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/Python/pythonrun.c:1296:15 (python+0x69a4e1) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#18 _PyRun_SimpleFileObject /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/Python/pythonrun.c:518:13 (python+0x698aca) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#19 _PyRun_AnyFileObject /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/Python/pythonrun.c:81:15 (python+0x6981a6) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#20 pymain_run_file_obj /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/Modules/main.c:411:15 (python+0x6ee3ad) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#21 pymain_run_file /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/Modules/main.c:430:15 (python+0x6ee3ad)
#22 pymain_run_python /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/Modules/main.c:715:21 (python+0x6ed206) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#23 Py_RunMain /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/Modules/main.c:796:5 (python+0x6ed206)
#24 pymain_main /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/Modules/main.c:826:12 (python+0x6ed977) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#25 Py_BytesMain /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/Modules/main.c:850:12 (python+0x6eda24) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#26 main /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/./Programs/python.c:15:12 (python+0x184cc0) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
SUMMARY: ThreadSanitizer: data race /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/./Include/cpython/pyatomic_gcc.h:513:3 in _Py_atomic_store_ssize_relaxed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment