After enabling PYTHONTHREADDEBUG=1 I got the dprintf output.
I added line info (as fixed text) asin:
Python/thread_pthread.h:
+511 PyLockStatus
+512 PyThread_acquire_lock_timed(PyThread_type_lock lock, PY_TIMEOUT_T microseconds,
+513 int intr_flag)
+514 {
+515 PyLockStatus success = PY_LOCK_FAILURE;
+516 pthread_lock *thelock = (pthread_lock *)lock;
+517 int status, error = 0;
+518
+519 dprintf(("519: PyThread_acquire_lock_timed(%p, %lld, %d) called\n",
+520 lock, microseconds, intr_flag));
+521
+522 if (microseconds == 0) {
+523 status = pthread_mutex_trylock( &thelock->mut );
+524 if (status != EBUSY)
+525 CHECK_STATUS_PTHREAD("pthread_mutex_trylock[1]");
+526 }
+527 else {
+528 status = pthread_mutex_lock( &thelock->mut );
+529 CHECK_STATUS_PTHREAD("pthread_mutex_lock[1]");
+530 }
and can establish that USE_SEMAPHORES is not being used.
There are many reasons why - I expect - something re: Python3.5 (issue23428) talks about this routine and also something about CLOCk_MONOTONIC versus CLOCK_REALTIME (hope I spelled those right).
Further, back in Python 2.3 days - issue525532 added POSIX support for semaphores.
I would love to proceed - but particularly, issue23428 makes me think I should not think that the logic that keeps USE_SEMAPHORE is incorrect.
Help appreciated!
p.s. - deeper details
with PYTHONTHREADDEBUG=1 I no longer get a segmentation fault. Instead I get:
Total duration: 1 min 53 sec
Tests result: NO TEST RUN
Exception in thread Thread-1:
Traceback (most recent call last):
File "/home/buildbot/buildarea/3.x.aixtools-aix-power6/issue/Lib/threading.py", line 917, in _bootstrap_inner
self.run()
File "/home/buildbot/buildarea/3.x.aixtools-aix-power6/issue/Lib/test/libregrtest/runtest_mp.py", line 145, in run
stop = self._runtest()
File "/home/buildbot/buildarea/3.x.aixtools-aix-power6/issue/Lib/test/libregrtest/runtest_mp.py", line 135, in _runtest
result = json.loads(result)
File "/home/buildbot/buildarea/3.x.aixtools-aix-power6/issue/Lib/json/__init__.py", line 348, in loads
return _default_decoder.decode(s)
File "/home/buildbot/buildarea/3.x.aixtools-aix-power6/issue/Lib/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/home/buildbot/buildarea/3.x.aixtools-aix-power6/issue/Lib/json/decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
Exception in thread Thread-2:
Traceback (most recent call last):
File "/home/buildbot/buildarea/3.x.aixtools-aix-power6/issue/Lib/threading.py", line 917, in _bootstrap_inner
self.run()
File "/home/buildbot/buildarea/3.x.aixtools-aix-power6/issue/Lib/test/libregrtest/runtest_mp.py", line 145, in run
stop = self._runtest()
File "/home/buildbot/buildarea/3.x.aixtools-aix-power6/issue/Lib/test/libregrtest/runtest_mp.py", line 135, in _runtest
result = json.loads(result)
File "/home/buildbot/buildarea/3.x.aixtools-aix-power6/issue/Lib/json/__init__.py", line 348, in loads
return _default_decoder.decode(s)
File "/home/buildbot/buildarea/3.x.aixtools-aix-power6/issue/Lib/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/home/buildbot/buildarea/3.x.aixtools-aix-power6/issue/Lib/json/decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
?
This is prefixed by:
PyThread_allocate_lock called
PyThread_allocate_lock() -> 200a9b40
519: PyThread_acquire_lock_timed(200a9b40, 0, 0) called
577: PyThread_acquire_lock_timed(200a9b40, 0, 0) -> 1
PyThread_release_lock(200a5fe0) called
519: PyThread_acquire_lock_timed(200a9b40, 0, 0) called
577: PyThread_acquire_lock_timed(200a9b40, 0, 0) -> 0
519: PyThread_acquire_lock_timed(200a9b40, 29999996, 1) called
519: PyThread_acquire_lock_timed(200fe220, 0, 0) called
577: PyThread_acquire_lock_timed(200fe220, 0, 0) -> 1
PyThread_release_lock(200fe220) called
519: PyThread_acquire_lock_timed(200fe220, 0, 0) called
577: PyThread_acquire_lock_timed(200fe220, 0, 0) -> 1
PyThread_release_lock(200fe220) called
519: PyThread_acquire_lock_timed(20156c00, 0, 0) called
577: PyThread_acquire_lock_timed(20156c00, 0, 0) -> 1
PyThread_release_lock(20156c00) called
519: PyThread_acquire_lock_timed(20156c00, 0, 0) called
577: PyThread_acquire_lock_timed(20156c00, 0, 0) -> 1
PyThread_release_lock(20156c00) called
519: PyThread_acquire_lock_timed(200fe1a0, 0, 0) called
577: PyThread_acquire_lock_timed(200fe1a0, 0, 0) -> 1
PyThread_release_lock(200fe1a0) called
PyThread_free_lock(200fe1a0) called
PyThread_free_lock(200fe220) called
PyThread_free_lock(20156c00) called
519: PyThread_acquire_lock_timed(200a5fe0, 0, 0) called
577: PyThread_acquire_lock_timed(200a5fe0, 0, 0) -> 1
519: PyThread_acquire_lock_timed(200a5fe0, 0, 0) called
577: PyThread_acquire_lock_timed(200a5fe0, 0, 0) -> 0
PyThread_release_lock(200a9b40) called
PyThread_release_lock(200a5fe0) called
577: PyThread_acquire_lock_timed(200a9b40, 29999996, 1) -> 1
519: PyThread_acquire_lock_timed(200a5fe0, 0, 0) called
577: PyThread_acquire_lock_timed(200a5fe0, 0, 0) -> 1
PyThread_release_lock(200a9b40) called
PyThread_free_lock(200a9b40) called
519: PyThread_acquire_lock_timed(200a5fe0, 0, 0) called
577: PyThread_acquire_lock_timed(200a5fe0, 0, 0) -> 0
PyThread_release_lock(200a5fe0) called
PyThread_free_lock(200c44c0) called
PyThread_free_lock(200a81c0) called
519: PyThread_acquire_lock_timed(200b7e30, 0, 0) called
577: PyThread_acquire_lock_timed(200b7e30, 0, 0) -> 1
PyThread_release_lock(200b7e30) called
PyThread_release_lock(200fd1f0) called
PyThread_free_lock(200fd1f0) called
PyThread_free_lock(200a9ac0) called
PyThread_free_lock(200a6d30) called
PyThread_free_lock(200a5fe0) called
519: PyThread_acquire_lock_timed(200a3ac0, -1, 0) called
577: PyThread_acquire_lock_timed(200a3ac0, -1, 0) -> 1
PyThread_release_lock(200a3ac0) called
PyThread_exit_thread called
== Tests result: NO TEST RUN ==
Hope this helps! |