[New-bugs-announce] [issue44416] test_threading: test_print_exception() hangs and killed after 3h15

STINNER Victor report at bugs.python.org
Mon Jun 14 03:36:56 EDT 2021


New submission from STINNER Victor <vstinner at python.org>:

AMD64 Windows8.1 Refleaks 3.9:
https://buildbot.python.org/all/#/builders/6/builds/48

4:03:35 load avg: 3.98 [425/425/1] test_threading crashed (Exit code 1)
beginning 6 repetitions
123456
Timeout (3:15:00)!
Thread 0x00000748 (most recent call first):
  File "D:\buildarea\3.9.ware-win81-release.refleak\build\lib\subprocess.py", line 1479 in _readerthread
  File "D:\buildarea\3.9.ware-win81-release.refleak\build\lib\threading.py", line 907 in run
  File "D:\buildarea\3.9.ware-win81-release.refleak\build\lib\threading.py", line 970 in _bootstrap_inner
  File "D:\buildarea\3.9.ware-win81-release.refleak\build\lib\threading.py", line 927 in _bootstrap

Thread 0x00001138 (most recent call first):
  File "D:\buildarea\3.9.ware-win81-release.refleak\build\lib\subprocess.py", line 1479 in _readerthread
  File "D:\buildarea\3.9.ware-win81-release.refleak\build\lib\threading.py", line 907 in run
  File "D:\buildarea\3.9.ware-win81-release.refleak\build\lib\threading.py", line 970 in _bootstrap_inner
  File "D:\buildarea\3.9.ware-win81-release.refleak\build\lib\threading.py", line 927 in _bootstrap

Thread 0x00000b80 (most recent call first):
  File "D:\buildarea\3.9.ware-win81-release.refleak\build\lib\threading.py", line 1066 in _wait_for_tstate_lock
  File "D:\buildarea\3.9.ware-win81-release.refleak\build\lib\threading.py", line 1050 in join
  File "D:\buildarea\3.9.ware-win81-release.refleak\build\lib\subprocess.py", line 1508 in _communicate
  File "D:\buildarea\3.9.ware-win81-release.refleak\build\lib\subprocess.py", line 1134 in communicate
  File "D:\buildarea\3.9.ware-win81-release.refleak\build\lib\test\support\script_helper.py", line 132 in run_python_until_end
  File "D:\buildarea\3.9.ware-win81-release.refleak\build\lib\test\support\script_helper.py", line 140 in _assert_python
  File "D:\buildarea\3.9.ware-win81-release.refleak\build\lib\test\support\script_helper.py", line 156 in assert_python_ok
  File "D:\buildarea\3.9.ware-win81-release.refleak\build\lib\test\test_threading.py", line 1164 in test_print_exception
  ...

The test runs a subprocess, the logs don't say where the child process was stuck:

    def test_print_exception(self):
        script = r"""if True:
            import threading
            import time

            running = False
            def run():
                global running
                running = True
                while running:
                    time.sleep(0.01)
                1/0
            t = threading.Thread(target=run)
            t.start()
            while not running:
                time.sleep(0.01)
            running = False
            t.join()
            """
        rc, out, err = assert_python_ok("-c", script)
        self.assertEqual(out, b'')
        err = err.decode()
        self.assertIn("Exception in thread", err)
        self.assertIn("Traceback (most recent call last):", err)
        self.assertIn("ZeroDivisionError", err)
        self.assertNotIn("Unhandled exception", err)

Note: using a "busy loop" to (1) waits until the thread starts (2) waits until the thread is requested to stop, is not an effecient way to synchonize. One two threading.Event would be better.

----------
components: Tests
messages: 395779
nosy: vstinner
priority: normal
severity: normal
status: open
title: test_threading: test_print_exception() hangs and killed after 3h15
versions: Python 3.9

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue44416>
_______________________________________


More information about the New-bugs-announce mailing list