Closed
Description
Bug report
Bug description:
There is a potential race when _PyParkingLot_UnparkAll
is executing in one thread and another thread is unblocked because of an interrupt in _PyParkingLot_Park
. Consider the following scenario:
- Thread T0 is blocked in
_PyParkingLot_Park
on addressA
. - Thread T1 executes
_PyParkingLot_UnparkAll
on addressA
. It finds thewait_entry
forT0
and unlinks its list node. - Immediately after (2), T0 is woken up due to an interrupt. It then segfaults trying to unlink the node that was previously unlinked in (2).
I haven't attempted to write a minimal repro for this. It occurs reliably on MacOS on this PR when running ./python.exe -m test test_asyncio.test_events --match test_get_event_loop_new_process
.
CPython versions tested on:
CPython main branch
Operating systems tested on:
macOS