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

Select an option

Save devdanzin/1ee2570ab23f267edce7236d0877a632 to your computer and use it in GitHub Desktop.
TSAN-0035: socket: PySocketSockObject.sock_timeout is read and written with plain non-atomic accesses (gettimeout() vs setblocking()), the one per-socket scalar left behind by the gh-128277 free-threading conversion

Data race: socket.gettimeout() reads sock_timeout non-atomically while socket.setblocking() writes it (socketmodule.c:3308 vs :3172)

TSAN-0035 · found by fusil --tsan (fleet-04, ssl module vehicle) · CPython 3.16.0a0 free-threaded

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

PySocketSockObject.sock_timeout (Modules/socketmodule.h:347, a PyTime_t = int64_t) is per-socket mutable state that Python-level methods both read and write with plain, non-atomic accesses. Calling s.gettimeout() on a socket while another thread calls s.setblocking() on it is a data race on that field:

site access
write sock_setblocking — socketmodule.c:3172:21 s->sock_timeout = _PyTime_FromSeconds(block ? -1 : 0);
read sock_gettimeout_impl — socketmodule.c:3308:12 if (s->sock_timeout < 0) {

Neither takes a critical section; neither uses an atomic. All 15 accesses to sock_timeout in socketmodule.c are plain — there is no synchronization on this field anywhere.

This is an incomplete free-threading conversion, not an isolated oversight. Two neighbouring pieces of state were explicitly converted, and sock_timeout was left behind:

  • s->sock_fd — the sibling field on the same struct — was given relaxed-atomic accessors get_sock_fd/set_sock_fd (socketmodule.c:567-592) by gh-128277 / PR #128304.
  • state->defaulttimeout — a PyTime_t, the exact same type as sock_timeout — was made atomic by gh-116616 / PR #116623.

The primitive the fix needs is therefore already used in this very file, on this very type: socketmodule.c:1134 reads the default with _Py_atomic_load_int64_relaxed(&state->defaulttimeout) — and assigns the result into s->sock_timeout with a plain store.

Reproducer

repro.py — stdlib only, no network (an unconnected socket has a sock_timeout like any other). One writer thread + 4 reader threads on one shared socket, so the only pair TSan can report is the read/write pair of interest.

Run under the standard wrapper:

setarch -R env -u PYTHON_GIL PYTHON_GIL=0 \
  TSAN_OPTIONS='halt_on_error=1:symbolize=1:exitcode=66:history_size=4' \
  DEBUGINFOD_URLS= \
  bash -c 'ulimit -v unlimited; exec .../builds/debug-ft-nojit-tsan/python repro.py'

Hit rate: 10/10 runs exit 66, typically within a second. The reported sites and .so offsets match the fleet vehicle exactly (_socket...so+0x10f46 for sock_setblocking).

TSan report

See tsan_report.txt for the full block. The two stanzas:

WARNING: ThreadSanitizer: data race (pid=3522357)
  Read of size 8 at 0x7fffb68d0238 by thread T4:
    #0 sock_gettimeout_impl ./Modules/socketmodule.c:3308:12
    #1 sock_gettimeout_method ./Modules/socketmodule.c:3320:12
    #2 method_vectorcall_NOARGS Objects/descrobject.c:448:24
  Previous write of size 8 at 0x7fffb68d0238 by thread T5:
    #0 sock_setblocking ./Modules/socketmodule.c:3172:21
    #1 cfunction_vectorcall_O Objects/methodobject.c:536:24
SUMMARY: ThreadSanitizer: data race ./Modules/socketmodule.c:3308:12 in sock_gettimeout_impl

Root cause

sock_setblocking (socketmodule.c:3165-3177):

static PyObject *
sock_setblocking(PyObject *self, PyObject *arg)
{
    long block;

    block = PyObject_IsTrue(arg);
    if (block < 0)
        return NULL;

   PySocketSockObject *s = _PySocketSockObject_CAST(self);
    s->sock_timeout = _PyTime_FromSeconds(block ? -1 : 0);   /* :3172 — plain store */
    if (internal_setblocking(s, block) == -1) {              /* :3173 */
        return NULL;
    }
    Py_RETURN_NONE;
}

sock_gettimeout_impl (socketmodule.c:3305-3315):

static PyObject *
sock_gettimeout_impl(PyObject *self, void *Py_UNUSED(ignored))
{
    PySocketSockObject *s = _PySocketSockObject_CAST(self);
    if (s->sock_timeout < 0) {                               /* :3308 — plain load */
        Py_RETURN_NONE;
    }
    else {
        double seconds = PyTime_AsSecondsDouble(s->sock_timeout);  /* :3312 */
        return PyFloat_FromDouble(seconds);
    }
}

sock_settimeout (:3264) has the identical shape — plain store, then internal_setblocking. sock_getblocking (:3194) is a third plain reader.

Impact / severity

Low. This is a real data race, but as compiled it is a benign value race, and I could not demonstrate any Python-visible misbehaviour. Being specific about what was checked and what was ruled out:

No tearing. sock_timeout is a naturally-aligned 8-byte scalar, so the load and store are each atomic in hardware on x86-64. A reader observes either the old or the new value — never a mix. Both setblocking(False) (→ 0) and setblocking(True) (→ -1s) are legal values, so a stale read just means gettimeout() returns the answer from a moment earlier — inherent to racing the call anyway.

The obvious TOCTOU is not real — I checked the machine code. sock_gettimeout_impl reads s->sock_timeout twice in the C source (:3308 compare, :3312 argument). If those were two separate loads, an interleaved setblocking(True) could make the compare see 0 and the reload see -1s, so gettimeout() would return -1.0 — out of contract (documented as None or a non-negative float). The compiler coalesces both source reads into one load, so this cannot happen here:

socketmodule.c:3308
  111bd:  call   __tsan_read8@plt     # one instrumented read
  111c2:  mov    0x38(%rbx),%rdi      # ONE load; %rdi is both the compared value ...
  111c6:  test   %rdi,%rdi
  111c9:  js     111da                # ... and
socketmodule.c:3312
  111cb:  call   PyTime_AsSecondsDouble@plt   # ... the argument, unreloaded

The same holds for the other double-read, _socket_socket_sendall (:4691 has_timeout / :4692 timeout): one __tsan_read8, one mov into %r14. So has_timeout and timeout cannot disagree either. An empirical probe agreed — 0 contract violations in ~10k racing gettimeout() calls.

This coalescing is a compiler courtesy, not a guarantee: the C11 model makes the race UB, and a compiler is entitled to reload. The TOCTOU is latent, not live.

A compound-state hazard exists but I could not trigger it. setblocking updates two things non-atomically: the sock_timeout field (:3172), then the FD's O_NONBLOCK flag via internal_setblocking (:3173). Two threads calling setblocking(True)/setblocking(False) could in principle interleave store_a, store_b, ioctl_b, ioctl_a, leaving sock_timeout == 0 ("non-blocking") while the FD is genuinely blocking. That state would matter: sock_call_ex gates its select() on has_timeout = (timeout > 0) (:971), so a sock_timeout of 0 skips select() and calls recv() straight on a blocking FD — a hang. But the window between the store and the ioctl is ~2 instructions, and I observed 0 divergences in 28,800 racing pairs (oversubscribed 96 threads on 16 cores, checking getblocking() against the real fcntl(F_GETFL) & O_NONBLOCK). So this is a theoretical hazard, reported as such — not a demonstrated bug.

Worth fixing because it is cheap, it is squarely in the gh-116738 remit, and it removes UB that today only happens to be harmless. Not worth fixing urgently.

Real bug vs. expected

Real, in scope. A socket shared across threads is an entirely ordinary pattern, and Modules/socketmodule.c was explicitly hardened for free-threading (gh-128277); the fix is atomics or a critical section matching whatever the writer uses. Here the module has already made that choice twice on this very struct (sock_fd, state->defaulttimeout) and simply missed this field.

Suggested fix

Mirror the existing get_sock_fd/set_sock_fd pattern with a get_sock_timeout/set_sock_timeout accessor pair over _Py_atomic_load_int64_relaxed / _Py_atomic_store_int64_relaxed (already used on a PyTime_t at socketmodule.c:1134), and route all 15 accesses through them. Relaxed ordering suffices — it matches what defaulttimeout already does. The non-free-threaded build is unaffected (the FT wrappers are plain accesses there).

static inline void
set_sock_timeout(PySocketSockObject *s, PyTime_t timeout)
{
    _Py_atomic_store_int64_relaxed(&s->sock_timeout, timeout);
}

static inline PyTime_t
get_sock_timeout(PySocketSockObject *s)
{
    return _Py_atomic_load_int64_relaxed(&s->sock_timeout);
}

Note this silences TSan and removes the UB but does not address the compound-state hazard above — setblocking/settimeout would still update the field and the FD flag non-atomically. Closing that too requires a per-socket critical section around the whole method. Given it could not be triggered in 28,800 attempts, the atomics alone are a reasonable first step; the critical section is a judgement call for the maintainers.

Issue search — verdict: NEW

Searched gh search issues/prs --repo python/cpython for socketmodule, sock_timeout, socket free-threading, socket data race, _socket thread, settimeout race, socketmodule thread safety, socketmodule critical section. Nothing covers this field.

  • gh-116738 ("Audit all built-in modules for thread safety") — in remit, and already checked off: the list contains - [x] Modules/socketmodule.c. This finding is evidence that checkbox is premature.
  • gh-128277 ("Make socket module thread safe") — CLOSED, opened precisely because of TSan warnings from the socket module. Its three merged PRs are #128286 (globals), #128304 (sock_fd atomics) and #128305 (remove a critical section from socket.close). None of the three diffs touches sock_timeout (verified: gh pr diff | grep -c sock_timeout = 0 for all three). This is the direct predecessor and the gap it left.
  • gh-116616 ("use atomics to access defaulttimeout") — CLOSED; converted the module-global PyTime_t timeout. Its per-socket twin was never done. Does not mention sock_timeout.
  • #149816 ("22 free-threading race conditions") — does not list _socket at all; no overlap.
  • gh-74667 (getservbyname et al. not threadsafe) — different subject (global netdb calls).

So: not filed. It belongs under gh-128277's story and should reference it.

Notes

Vehicle: fusil-tsan_fleet_04/inst-03/python-2/ssl-warning_threadsanitizer_data_race-tsanNEW (surfaced via the ssl module, which reads sock->sock_timeout directly in four places — _ssl.c:453, :839, :1024, :2543 — all plain, so _ssl inherits the same race).

import socket, sys, threading
assert not sys._is_gil_enabled(), "run free-threaded: PYTHON_GIL=0"
# PySocketSockObject.sock_timeout (Modules/socketmodule.h:347, a PyTime_t == int64_t) is
# per-socket mutable state that Python-level methods both write and read with PLAIN,
# non-atomic accesses:
#
# sock_setblocking socketmodule.c:3172 s->sock_timeout = _PyTime_FromSeconds(...) WRITE
# sock_gettimeout_impl socketmodule.c:3308 if (s->sock_timeout < 0) READ
#
# Neither is atomic and neither takes a critical section, so gettimeout() on a socket another
# thread is calling setblocking() on is a data race on that field.
#
# This is an INCOMPLETE free-threading conversion, not an oversight in isolation: the sibling
# field sock_fd on the SAME struct was given relaxed-atomic accessors (get_sock_fd/set_sock_fd,
# socketmodule.c:567-592) by gh-128277/PR#128304, and the module-global state->defaulttimeout --
# a PyTime_t, the exact same type as sock_timeout -- was made atomic by gh-116616/PR#116623.
# sock_timeout is the one mutable per-socket scalar that was left plain.
#
# One writer + N readers, so the only pair TSan can report is the read/write pair we want.
# No network needed: an unconnected socket has a sock_timeout like any other.
NR = 4 # reader threads: gettimeout() -- plain read
ROUNDS = 20000
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
start = threading.Barrier(NR + 1)
stop = threading.Event()
def reader():
start.wait()
while not stop.is_set():
s.gettimeout() # -> sock_gettimeout_impl: plain read of s->sock_timeout
def writer():
start.wait()
for n in range(ROUNDS):
# setblocking(False) -> sock_timeout = 0; setblocking(True) -> sock_timeout = -1s
s.setblocking(n & 1) # -> sock_setblocking: plain write of s->sock_timeout
stop.set()
threads = [threading.Thread(target=reader) for _ in range(NR)]
threads.append(threading.Thread(target=writer))
for t in threads:
t.start()
for t in threads:
t.join()
s.close()
print("done, no crash")
WARNING: ThreadSanitizer: data race (pid=3522357)
Read of size 8 at 0x7fffb68d0238 by thread T4:
#0 sock_gettimeout_impl /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/./Modules/socketmodule.c:3308:12 (_socket.cpython-316td-x86_64-linux-gnu.so+0x111c1) (BuildId: 3bcbaf91a3e507dcae841c210b4b9afe6877e627)
#1 sock_gettimeout_method /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/./Modules/socketmodule.c:3320:12 (_socket.cpython-316td-x86_64-linux-gnu.so+0x111c1)
#2 method_vectorcall_NOARGS /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/Objects/descrobject.c:448:24 (python+0x2b51e0) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#3 _PyObject_VectorcallTstate /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/./Include/internal/pycore_call.h:144:11 (python+0x294b28) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#4 PyObject_Vectorcall /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/Objects/call.c:327:12 (python+0x296660) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#5 _Py_VectorCallInstrumentation_StackRefSteal /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/Python/ceval.c:768:11 (python+0x536b24) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#6 _PyEval_EvalFrameDefault /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/Python/generated_cases.c.h:1906:35 (python+0x5662d0) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#7 _PyEval_EvalFrame /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/./Include/internal/pycore_ceval.h:122:16 (python+0x53601c) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#8 _PyEval_Vector /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/Python/ceval.c:2171:12 (python+0x53601c)
#9 _PyFunction_Vectorcall /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/Objects/call.c (python+0x296ba6) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#10 _PyObject_VectorcallTstate /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/./Include/internal/pycore_call.h:144:11 (python+0x294b28) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#11 _PyObject_VectorcallPrepend /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/Objects/call.c:855:20 (python+0x298682) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#12 method_vectorcall /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/Objects/classobject.c:55:12 (python+0x29b26a) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#13 _PyObject_VectorcallTstate /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/./Include/internal/pycore_call.h:144:11 (python+0x5b472a) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#14 context_run /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/Python/context.c:731:29 (python+0x5b472a)
#15 method_vectorcall_FASTCALL_KEYWORDS /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/Objects/descrobject.c:421:24 (python+0x2b4ff6) (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 _PyVectorcall_Call /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/Objects/call.c:273:16 (python+0x296512) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#27 _PyObject_Call /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/Objects/call.c:348:16 (python+0x296785) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#28 PyObject_Call /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/Objects/call.c:373:12 (python+0x2969a7) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#29 thread_run /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/./Modules/_threadmodule.c:388:21 (python+0x7e0778) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#30 pythread_wrapper /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/Python/thread_pthread.h:234:5 (python+0x6cd55b) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
Previous write of size 8 at 0x7fffb68d0238 by thread T5:
#0 sock_setblocking /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/./Modules/socketmodule.c:3172:21 (_socket.cpython-316td-x86_64-linux-gnu.so+0x10f46) (BuildId: 3bcbaf91a3e507dcae841c210b4b9afe6877e627)
#1 method_vectorcall_O /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/Objects/descrobject.c:476:24 (python+0x2b53ff) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#2 _PyObject_VectorcallTstate /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/./Include/internal/pycore_call.h:144:11 (python+0x294b28) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#3 PyObject_Vectorcall /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/Objects/call.c:327:12 (python+0x296660) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#4 _Py_VectorCallInstrumentation_StackRefSteal /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/Python/ceval.c:768:11 (python+0x536b24) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#5 _PyEval_EvalFrameDefault /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/Python/generated_cases.c.h:1906:35 (python+0x5662d0) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#6 _PyEval_EvalFrame /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/./Include/internal/pycore_ceval.h:122:16 (python+0x53601c) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#7 _PyEval_Vector /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/Python/ceval.c:2171:12 (python+0x53601c)
#8 _PyFunction_Vectorcall /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/Objects/call.c (python+0x296ba6) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#9 _PyObject_VectorcallTstate /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/./Include/internal/pycore_call.h:144:11 (python+0x294b28) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#10 _PyObject_VectorcallPrepend /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/Objects/call.c:855:20 (python+0x298682) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#11 method_vectorcall /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/Objects/classobject.c:55:12 (python+0x29b26a) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#12 _PyObject_VectorcallTstate /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/./Include/internal/pycore_call.h:144:11 (python+0x5b472a) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#13 context_run /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/Python/context.c:731:29 (python+0x5b472a)
#14 method_vectorcall_FASTCALL_KEYWORDS /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/Objects/descrobject.c:421:24 (python+0x2b4ff6) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#15 _PyObject_VectorcallTstate /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/./Include/internal/pycore_call.h:144:11 (python+0x294b28) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#16 PyObject_Vectorcall /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/Objects/call.c:327:12 (python+0x296660) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#17 _Py_VectorCallInstrumentation_StackRefSteal /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/Python/ceval.c:768:11 (python+0x536b24) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#18 _PyEval_EvalFrameDefault /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/Python/generated_cases.c.h:1906:35 (python+0x5662d0) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#19 _PyEval_EvalFrame /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/./Include/internal/pycore_ceval.h:122:16 (python+0x53601c) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#20 _PyEval_Vector /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/Python/ceval.c:2171:12 (python+0x53601c)
#21 _PyFunction_Vectorcall /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/Objects/call.c (python+0x296ba6) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#22 _PyObject_VectorcallTstate /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/./Include/internal/pycore_call.h:144:11 (python+0x294b28) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#23 _PyObject_VectorcallPrepend /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/Objects/call.c:855:20 (python+0x298682) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#24 method_vectorcall /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/Objects/classobject.c:55:12 (python+0x29b26a) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#25 _PyVectorcall_Call /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/Objects/call.c:273:16 (python+0x296512) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#26 _PyObject_Call /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/Objects/call.c:348:16 (python+0x296785) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#27 PyObject_Call /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/Objects/call.c:373:12 (python+0x2969a7) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#28 thread_run /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/./Modules/_threadmodule.c:388:21 (python+0x7e0778) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#29 pythread_wrapper /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/Python/thread_pthread.h:234:5 (python+0x6cd55b) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
Thread T4 'Thread-4 (reade' (tid=3522362, 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 T5 'Thread-5 (write' (tid=3522363, 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)
SUMMARY: ThreadSanitizer: data race /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/./Modules/socketmodule.c:3308:12 in sock_gettimeout_impl
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment