-
-
Notifications
You must be signed in to change notification settings - Fork 33.2k
Closed
Labels
testsTests in the Lib/test dirTests in the Lib/test dirtopic-C-APItype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Description
I've only seen this locally and not in the CI. Might be a clang-17 vs. clang-20 difference.
The fix is straightforward. I'll put up a PR soon.
Repro
export CC=clang-20
./configure --with-thread-sanitizer --with-pydebug
make -j
./python -m test test_capi test_capi test_capi test_capi test_capi -j 0
WARNING: ThreadSanitizer: data race (pid=2672971)
Read of size 1 at 0x7fffffff8c60 by main thread:
#0 test_lock_two_threads Modules/_testinternalcapi/test_lock.c:94 (_testinternalcapi.cpython-315td-x86_64-linux-gnu.so+0x11ad5) (BuildId: 1e994b90a1f0984ae2dacb9cd1e19d050cf78bac)
#1 cfunction_vectorcall_NOARGS Objects/methodobject.c:508 (python+0x21cc12) (BuildId: 6fc26b3c3327cccb93ba2e82f6a5e0fd108f0ec7)
#2 _PyObject_VectorcallTstate Include/internal/pycore_call.h:169 (python+0x1918e5) (BuildId: 6fc26b3c3327cccb93ba2e82f6a5e0fd108f0ec7)
...
Previous atomic write of size 1 at 0x7fffffff8c60 by thread T53:
#0 _Py_atomic_compare_exchange_uint8 Include/cpython/pyatomic_gcc.h:105 (_testinternalcapi.cpython-315td-x86_64-linux-gnu.so+0x11206) (BuildId: 1e994b90a1f0984ae2dacb9cd1e19d050cf78bac)
#1 _PyMutex_Lock Include/cpython/pylock.h:55 (_testinternalcapi.cpython-315td-x86_64-linux-gnu.so+0x11206)
#2 lock_thread Modules/_testinternalcapi/test_lock.c:59 (_testinternalcapi.cpython-315td-x86_64-linux-gnu.so+0x1169f) (BuildId: 1e994b90a1f0984ae2dacb9cd1e19d050cf78bac)
#3 pythread_wrapper Python/thread_pthread.h:234 (python+0x47aa1e) (BuildId: 6fc26b3c3327cccb93ba2e82f6a5e0fd108f0ec7)
As if synchronized via sleep:
#0 usleep ../../../../src/libsanitizer/tsan/tsan_interceptors_posix.cpp:390 (libtsan.so.2+0x587d1) (BuildId: 38097064631f7912bd33117a9c83d08b42e15571)
#1 pysleep Modules/_testinternalcapi/test_lock.c:28 (_testinternalcapi.cpython-315td-x86_64-linux-gnu.so+0x10d41) (BuildId: 1e994b90a1f0984ae2dacb9cd1e19d050cf78bac)
#2 test_lock_two_threads Modules/_testinternalcapi/test_lock.c:87 (_testinternalcapi.cpython-315td-x86_64-linux-gnu.so+0x11a98) (BuildId: 1e994b90a1f0984ae2dacb9cd1e19d050cf78bac)
#3 cfunction_vectorcall_NOARGS Objects/methodobject.c:508 (python+0x21cc12) (BuildId: 6fc26b3c3327cccb93ba2e82f6a5e0fd108f0ec7)
...
Linked PRs
Metadata
Metadata
Assignees
Labels
testsTests in the Lib/test dirTests in the Lib/test dirtopic-C-APItype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error