Open
Description
Bug report
The lock may have the _Py_HAS_PARKED
bit set so that m->_bits == 3
instead of 1. This can happen due to collisions in the parking lot hash table -- that's rare so we don't see it frequently. I think the possible collision here is if the PyEvent
that the main thread is waiting on uses the same bucket as the PyMutex
.
We should weaken the assertion in the test case.
See in https://buildbot.python.org/all/#/builders/1609/builds/2878/steps/6/logs/stdio:
test_lock_two_threads (test.test_capi.test_misc.Test_PyLock.test_lock_two_threads) ... python: ./Modules/_testinternalcapi/test_lock.c:60: lock_thread: Assertion `m->_bits == 1' failed.
Fatal Python error: Aborted
Current thread's C stack trace (most recent call first):
Binary file "/home/buildbot/buildarea/3.x.itamaro-centos-aws.nogil/build/python", at _Py_DumpStack+0x31 [0x75b0f6]
Binary file "/home/buildbot/buildarea/3.x.itamaro-centos-aws.nogil/build/python" [0x770ae8]
Binary file "/home/buildbot/buildarea/3.x.itamaro-centos-aws.nogil/build/python" [0x770bd5]
Binary file "/lib64/libc.so.6", at +0x3ebf0 [0x7f3a97a3ebf0]
Binary file "/lib64/libc.so.6", at +0x8c1ec [0x7f3a97a8c1ec]
Binary file "/lib64/libc.so.6", at raise+0x16 [0x7f3a97a3eb46]
Binary file "/lib64/libc.so.6", at abort+0xd3 [0x7f3a97a28833]
Binary file "/lib64/libc.so.6", at +0x2875b [0x7f3a97a2875b]
Binary file "/lib64/libc.so.6", at +0x37886 [0x7f3a97a37886]
Binary file "/home/buildbot/buildarea/3.x.itamaro-centos-aws.nogil/build/build/lib.linux-x86_64-3.15/_testinternalcapi.cpython-315td-x86_64-linux-gnu.so", at +0xe2cf [0x7f3a970612cf]
Binary file "/home/buildbot/buildarea/3.x.itamaro-centos-aws.nogil/build/python" [0x756d51]
Binary file "/lib64/libc.so.6", at +0x8a4aa [0x7f3a97a8a4aa]
Binary file "/lib64/libc.so.6", at +0x10f510 [0x7f3a97b0f510]
cpython/Modules/_testinternalcapi/test_lock.c
Lines 52 to 98 in cb39410