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

Select an option

Save devdanzin/f0b4f8859da46e985f23aa9cadaaa4c9 to your computer and use it in GitHub Desktop.
TSAN-0025: readline: set_auto_history() writes the module-global should_auto_add_history flag without synchronization

Data race: readline.set_auto_history() writes the module-global should_auto_add_history flag with no synchronization (readline.c:843)

readline gates its "automatically add typed lines to history" behaviour on a file-scope C global static int should_auto_add_history (readline.c:825). readline.set_auto_history(bool) stores into it with a plain, unsynchronized assignment (readline.c:843) and its Argument Clinic function is not @critical_section; the flag is later read, also unsynchronized, in call_readline() (readline.c:1584). Two threads calling set_auto_history() concurrently are a TSan write/write data race on that global — and a set_auto_history() writer racing an interactive input()/readline() reader is the write/read variant. Distinct variable from the readlinestate completer/hook pointers of gh-153291; the correct fix here is FT_ATOMIC relaxed access, mirroring the sibling _history_length global in the same file.

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/readline.c keeps a single module-level flag controlling whether lines entered at the readline prompt are auto-appended to history:

static int should_auto_add_history = 1;      /* readline.c:825 */

The public setter writes it directly, with no lock and no atomic. Its Argument Clinic block carries no @critical_section directive (contrast the very next function in the file, readline.get_completer_delims, which does):

/*[clinic input]
readline.set_auto_history
    enabled as _should_auto_add_history: bool
    /
Enables or disables automatic history.
[clinic start generated code]*/

static PyObject *
readline_set_auto_history_impl(PyObject *module, int _should_auto_add_history)
{
    should_auto_add_history = _should_auto_add_history;   /* readline.c:843  WRITE (4 bytes) */
    Py_RETURN_NONE;
}

The flag is consumed, also unsynchronized, in the core input routine call_readline():

n = strlen(p);
if (should_auto_add_history && n > 0) {                   /* readline.c:1584  READ */
    ...
    add_history(p);
}

Two threads calling readline.set_auto_history(...) on the shared readline module race on the single 4-byte global (write/write). A thread calling set_auto_history() while another blocks in input()/readline() is the write/read variant against call_readline(). TSan reports it as a data race on global 'should_auto_add_history', both accesses 4 bytes at readline.c:843.

Reproducer

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

NT = 6                       # total worker threads
ROUNDS = 4000
enter = threading.Barrier(NT + 1)
leave = threading.Barrier(NT + 1)

def worker(on):
    for _ in range(ROUNDS):
        enter.wait()
        readline.set_auto_history(on)   # write should_auto_add_history (:843)
        readline.set_auto_history(not on)
        leave.wait()

# half the threads drive the flag toward True, half toward False -> the store
# actually changes the word both ways, maximising the racing-write window.
ts = [threading.Thread(target=worker, args=(i % 2 == 0,)) for i in range(NT)]
for t in ts: t.start()
for _ in range(ROUNDS):
    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, heads/main:bcf98ddbc40)

WARNING: ThreadSanitizer: data race (pid=2169689)
  Write of size 4 at 0x7ffff630f794 by thread T5:
    #0 readline_set_auto_history_impl Modules/readline.c:843:29   (should_auto_add_history = _should_auto_add_history)
    #1 readline_set_auto_history      Modules/clinic/readline.c.h:571:20
    ...
    #25 thread_run                    Modules/_threadmodule.c:388:21

  Previous write of size 4 at 0x7ffff630f794 by thread T4:
    #0 readline_set_auto_history_impl Modules/readline.c:843:29   (should_auto_add_history = _should_auto_add_history)
    #1 readline_set_auto_history      Modules/clinic/readline.c.h:571:20
    ...
    #25 thread_run                    Modules/_threadmodule.c:388:21

  Location is global 'should_auto_add_history' of size 4 at 0x7ffff630f794 (readline...so+0xe794)

SUMMARY: ThreadSanitizer: data race Modules/readline.c:843:29 in readline_set_auto_history_impl

Reproduces deterministically (exit 66 on every run; two consecutive runs both flagged the same write/write pair on global 'should_auto_add_history'). The Location is global '...' line names the exact racing object, matching the seeded signature (both frames readline_set_auto_history_impl at readline.c:843).

Root cause

should_auto_add_history is a file-scope C global owned by CPython's Modules/readline.c (defined readline.c:825, initialised to 1). It is written by set_auto_history() (readline.c:843) and read by call_readline() (readline.c:1584), both with plain, non-atomic, unlocked accesses. Nothing establishes happens-before between a writer thread and any other writer or reader thread, so under free-threading these are data races on a shared word.

This is an incomplete free-threading migration in a file that has already partially adopted the primitives. The immediately analogous global in the same file — static int _history_length (readline.c:320) — was converted to atomics: it is written via FT_ATOMIC_STORE_INT_RELAXED(_history_length, length) in set_history_length (readline.c:450) and read via FT_ATOMIC_LOAD_INT_RELAXED(_history_length) (readline.c:361/420/467). should_auto_add_history is the same shape — a plain int flag driven by a Python-visible setter and read on the input path — but it was left as a bare global. Likewise the module's pointer setters were made @critical_section, but set_auto_history was not.

Scope: CPython's own global, not libreadline's, and not the readlinestate struct

The racing memory is should_auto_add_history, a static in CPython's Modules/readline.c (Location is global 'should_auto_add_history', in the readline...so image). It is not a GNU libreadline internal global (no _rl_* / rl_*), so it is fully fixable inside Modules/readline.c — distinct from the thread-unsafe-C-library class tracked under gh-127081 (locale/setlocale, libreadline reentrancy). It is also not part of the per-module readlinestate heap block; it is a process-wide file-scope static.

Relationship to gh-153291 / TSAN-0016 (the sibling readline race this campaign found)

Same file and same broad class (unsynchronized CPython-owned readline module state, incomplete FT migration), but a distinct variable and a distinct fix:

  • gh-153291 (PR gh-153362, "Fix data race in readline.get_completer() and get_pre_input_hook()" — this campaign's TSAN-0016) concerns the readlinestate pointer fields (state->completer, state->pre_input_hook, ...): PyObject* in per-module heap state whose getters lacked the @critical_section their setters hold. Its fix adds @critical_section to the getters and carries a latent borrowed-ref/use-after-free angle.
  • TSAN-0025 (this report) concerns should_auto_add_history: a plain file-scope static int flag, not in readlinestate, not a pointer, no refcount/UAF angle. The gh-153291 patch does not touch it, and @critical_section is the wrong tool (the flag is a process-global, not per-module-object state). The right fix is FT_ATOMIC relaxed access, matching _history_length.

So this is a separate, still-open readline free-threading gap, part of the same incomplete-migration cleanup but not covered by the gh-153291 fix.

Impact / severity

Low. The flag is a single aligned 4-byte word holding a boolean; torn reads/writes are not a practical concern on the target and the race is value-benign (no refcount, no pointer, no allocation involved) — worst case a concurrent input() observes a stale enable/disable decision for one line of history. There is no crash or memory-safety hazard, unlike the borrowed-ref angle of gh-153291. It remains a genuine TSan data race on CPython-owned shared state reachable entirely from pure Python (readline.set_auto_history() plus a second set_auto_history() or an input()), and it violates the reasonable expectation that a small module-config setter is thread-safe. Consistent with the other readline module-state findings in this campaign.

Suggested fix

Give should_auto_add_history the same relaxed-atomic treatment its sibling _history_length already has in this file — a mechanical, low-risk change:

/* write, readline.c:843 */
FT_ATOMIC_STORE_INT_RELAXED(should_auto_add_history, _should_auto_add_history);

/* read, readline.c:1584 */
if (FT_ATOMIC_LOAD_INT_RELAXED(should_auto_add_history) && n > 0) {

Relaxed ordering is sufficient: the flag is an independent boolean with no ordering dependency on other state. (Adding @critical_section to set_auto_history would silence the write/write case against other setters but would not order the write against the lockless call_readline() read, and does not match the process-global nature of the variable — the FT_ATOMIC approach used for _history_length is the correct, consistent one.)

Notes

Found by ThreadSanitizer fuzzing (fusil --tsan), fleet fusil-tsan_fleet_02. This is the second distinct readline free-threading gap this campaign surfaced (after the gh-153291 readlinestate getters). The pattern to audit across readline.c is "plain static module globals driven by Python setters": _history_length was converted to FT_ATOMIC, the completer/hook pointers are @critical_section (setters) / gh-153291-pending (getters), but should_auto_add_history was missed. It should be folded into the same readline FT cleanup.


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

import sys, threading, readline
assert not sys._is_gil_enabled(), "run free-threaded: PYTHON_GIL=0"
# Data race on CPython's readline module-level C global `should_auto_add_history`
# (Modules/readline.c:825, a plain `static int`). readline.set_auto_history()
# stores it with a plain, unsynchronized write (readline.c:843) and is NOT
# @critical_section; two threads toggling it concurrently is a write/write race
# on that global (TSan reports the pair of writes at readline.c:843).
NT = 6 # total worker threads
ROUNDS = 4000
enter = threading.Barrier(NT + 1)
leave = threading.Barrier(NT + 1)
def worker(on):
for _ in range(ROUNDS):
enter.wait()
readline.set_auto_history(on) # write should_auto_add_history (:843)
readline.set_auto_history(not on)
leave.wait()
# half the threads drive the flag toward True, half toward False -> the store
# actually changes the word both ways, maximising the racing-write window.
ts = [threading.Thread(target=worker, args=(i % 2 == 0,)) for i in range(NT)]
for t in ts: t.start()
for _ in range(ROUNDS):
enter.wait(); leave.wait()
for t in ts: t.join()
print("done, no crash")
WARNING: ThreadSanitizer: data race (pid=2118090)
Write of size 4 at 0x7fffb330f794 by thread T1:
#0 readline_set_auto_history_impl /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/./Modules/readline.c:843:29 (readline.cpython-316td-x86_64-linux-gnu.so+0x7db4) (BuildId: 7abfe0d0ff56b60e5317cd43be6ad415b8b2b505)
#1 readline_set_auto_history /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/./Modules/clinic/readline.c.h:571:20 (readline.cpython-316td-x86_64-linux-gnu.so+0x7db4)
#2 cfunction_vectorcall_O /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/Objects/methodobject.c:536:24 (python+0x36fec2) (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 4 at 0x7fffb330f794 by thread T2:
#0 readline_set_auto_history_impl /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/./Modules/readline.c:843:29 (readline.cpython-316td-x86_64-linux-gnu.so+0x7db4) (BuildId: 7abfe0d0ff56b60e5317cd43be6ad415b8b2b505)
#1 readline_set_auto_history /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/./Modules/clinic/readline.c.h:571:20 (readline.cpython-316td-x86_64-linux-gnu.so+0x7db4)
#2 cfunction_vectorcall_O /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/Objects/methodobject.c:536:24 (python+0x36fec2) (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_VectorCall_StackRefSteal /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/Python/ceval.c:726:11 (python+0x53636b) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#6 _PyEval_EvalFrameDefault /home/danzin/projects/python_build_matrix/builds/debug-ft-nojit-tsan/Python/generated_cases.c.h:4559:35 (python+0x54f13b) (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)
Location is global 'should_auto_add_history' of size 4 at 0x7fffb330f794 (readline.cpython-316td-x86_64-linux-gnu.so+0xe794)
Thread T1 'tsan_0_0' (tid=2118178, 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)
Thread T2 'tsan_0_1' (tid=2118179, 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/readline.c:843:29 in readline_set_auto_history_impl
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment