You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Race between _PyParkingLot_Park and _PyParkingLot_UnparkAll when handling interrupts #114944
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 address A.
Thread T1 executes _PyParkingLot_UnparkAll on address A. It finds the wait_entry for T0 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.
Activity
mpage commentedon Feb 3, 2024
Paging Dr. @colesbury
colesbury commentedon Feb 3, 2024
Ahh, good catch. We handle this case for the single unpark, but not unparkAll.
gh-114944: Fix race between `_PyParkingLot_Park` and `_PyParkingLot_U…
pythongh-114944: Fix race between `_PyParkingLot_Park` and `_PyParkin…