cpython
cpython copied to clipboard
test_deadlock sometimes causes deadlock
Bug report
Bug description:
Found at EuroPython 24 sprints.
./python -m test -j4
sometimes ends up hanging on
0:24:44 load avg: 0.80 running (1): test.test_concurrent_futures.test_deadlock (24 min 3 sec)
0:25:14 load avg: 0.56 running (1): test.test_concurrent_futures.test_deadlock (24 min 33 sec)
0:25:44 load avg: 0.47 running (1): test.test_concurrent_futures.test_deadlock (25 min 3 sec)
0:26:14 load avg: 0.35 running (1): test.test_concurrent_futures.test_deadlock (25 min 33 sec)
0:26:44 load avg: 0.45 running (1): test.test_concurrent_futures.test_deadlock (26 min 3 sec)
0:27:14 load avg: 0.54 running (1): test.test_concurrent_futures.test_deadlock (26 min 33 sec)
Also occurs on @stinovlas machine (Debian or Ubuntu). More details when I'll be reproduce deadlock again.
CPython versions tested on:
CPython main branch
Operating systems tested on:
Linux
Finally, I've managed to reproduce the deadlock by
# This script is in fish shell
for I in $(seq 100)
echo ===== Attempt $I =====
timeout 300 ./python -X dev -m test -j4 test_concurrent_futures -v
if test $status -ne 0
echo "TEST FAILED!"
break
end
end | tee /tmp/out.log
Here's the setup from the test output:
== CPython 3.14.0a0 (heads/main:dc03ce797a, Jul 13 2024, 09:48:51) [GCC 13.3.0]
== Linux-6.8.12-amd64-x86_64-with-glibc2.38 little-endian
== Python build: debug
== cwd: /home/ziima/git/cpython/build/test_python_worker_1032543æ
== CPU count: 4
== encodings: locale=UTF-8 FS=utf-8
== resources: all test resources are disabled, use -u option to unskip tests
Full output here: out.log
From my observations it seems to occur more often if I run tests on the whole test_concurrent_futures (or complete tests) than just test_concurrent_futures.test_deadlock. Tests are running on all 4 cores on my notebook.
@encukou It doesn't seem to me that -X dev provides any useful info in this case. If you have any more suggestions on how to debug it, I'm all ears.