Skip to content

Commit 737da25

Browse files
colesburymiss-islington
authored andcommitted
pythongh-117657: Avoid sem_clockwait in TSAN (pythonGH-119915)
The `sem_clockwait` function is not currently instrumented, which leads to false positives. (cherry picked from commit 41c1cef) Co-authored-by: Sam Gross <[email protected]>
1 parent 6b10467 commit 737da25

File tree

2 files changed

+1
-10
lines changed

2 files changed

+1
-10
lines changed

Python/parking_lot.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ _PySemaphore_PlatformWait(_PySemaphore *sema, PyTime_t timeout)
119119
if (timeout >= 0) {
120120
struct timespec ts;
121121

122-
#if defined(CLOCK_MONOTONIC) && defined(HAVE_SEM_CLOCKWAIT)
122+
#if defined(CLOCK_MONOTONIC) && defined(HAVE_SEM_CLOCKWAIT) && !defined(_Py_THREAD_SANITIZER)
123123
PyTime_t now;
124124
// silently ignore error: cannot report error to the caller
125125
(void)PyTime_MonotonicRaw(&now);

Tools/tsan/suppressions_free_threading.txt

-9
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,10 @@ race:set_allocator_unlocked
1515
# These entries are for warnings that trigger in a library function, as called
1616
# by a CPython function.
1717

18-
# https://gist.github.com/swtaarrs/9d41251e603fa6dedd604191a6da820d
19-
race:park_detached_threads
2018
# https://gist.github.com/swtaarrs/8e0e365e1d9cecece3269a2fb2f2b8b8
2119
race:sock_recv_impl
2220
# https://gist.github.com/swtaarrs/08dfe7883b4c975c31ecb39388987a67
2321
race:free_threadstate
24-
# https://gist.github.com/swtaarrs/cd6aec2006e0c1b561b68d65e9f1a872
25-
race:_PyParkingLot_Park
2622

2723

2824
# These warnings trigger directly in a CPython function.
@@ -33,8 +29,6 @@ race_top:_mi_heap_delayed_free_partial
3329
race_top:_PyEval_EvalFrameDefault
3430
race_top:_PyImport_AcquireLock
3531
race_top:_PyImport_ReleaseLock
36-
# https://gist.github.com/mpage/0a24eb2dd458441ededb498e9b0e5de8
37-
race_top:_PyParkingLot_Park
3832
race_top:_PyType_HasFeature
3933
race_top:assign_version_tag
4034
race_top:insertdict
@@ -47,8 +41,6 @@ race_top:set_contains_key
4741
# https://gist.github.com/colesbury/d13d033f413b4ad07929d044bed86c35
4842
race_top:set_discard_entry
4943
race_top:set_inheritable
50-
race_top:start_the_world
51-
race_top:tstate_set_detached
5244
race_top:Py_SET_TYPE
5345
race_top:_PyDict_CheckConsistency
5446
race_top:_PyImport_AcquireLock
@@ -65,7 +57,6 @@ race_top:list_get_item_ref
6557
race_top:make_pending_calls
6658
race_top:set_add_entry
6759
race_top:should_intern_string
68-
race_top:llist_insert_tail
6960
race_top:_Py_slot_tp_getattr_hook
7061
race_top:add_threadstate
7162
race_top:dump_traceback

0 commit comments

Comments
 (0)