Repository navigation
PyMutex failure in parking_lot.c on Windows during interpreter shutdown #135099
Copy link
Copy link
Closed
Labels
3.14bugs and security fixesbugs and security fixes3.15bugs and security fixesbugs and security fixestype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Description
Activity
- addedtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
on Jun 3, 2025 - changed the title
[-]PyMutex failure in parking_lot.c on Windows during interpreter shutdown[/-][+]`PyMutex` failure in `parking_lot.c` on Windows during interpreter shutdown[/+]on Jun 3, 2025 - added3.14bugs and security fixesbugs and security fixes3.15bugs and security fixesbugs and security fixes
on Jun 3, 2025 Since #134747 ("Change PyThread_allocate_lock() implementation to PyMutex") was merged, Windows tests got really flaky, with several tests failing in each buildbot run with the same error:
Fatal Python error: _PySemaphore_PlatformWait: unexpected error from semaphore: 4294967295 (error: 6) Python runtime state: finalizing (tstate=0x00007ff9a3c4aac8) Thread 0x000023c8 (most recent call first): <no Python frame> Windows fatal exception: code 0x80000003For example, here: https://buildbot.python.org/#/builders/146/builds/11597/steps/5/logs/stdio
Currently at the release status page, on several Windows buildbots you can see a point where they "switched" from mostly-green to consistent "warnings" result; on the few I explored the first "yellow" build was for #134747.
Do you think that's related?
Yes, I think it's related
Reacted by Petr Viktorin- added a commit that references this issue
on Jun 4, 2025
Metadata
Metadata
Assignees
Labels
3.14bugs and security fixesbugs and security fixes3.15bugs and security fixesbugs and security fixestype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Bug report
Bug description:
4294967295is the-1return code fromWaitForMultipleObjects. Error code 6 isERROR_INVALID_HANDLE.I'm pretty sure that the
_PyOS_SigintEvent()handle is getting closed concurrently with the mutex wait.cpython/Python/parking_lot.c
Lines 118 to 136 in 1ffe913
Seen in https://github.com/python/cpython/actions/runs/15423887404/job/43405853684 at the end of running
test_decorators.CPython versions tested on:
CPython main branch
Operating systems tested on:
Windows
Linked PRs
_PyOS_SigintEvent()in main thread #135100_PyOS_SigintEvent()in main thread (GH-135100) #135116