classification
Title: test_threading: test_print_exception() hangs and killed after 3h15 on AMD64 Windows8.1 Refleaks 3.9
Type: Stage: resolved
Components: Tests Versions: Python 3.9
process
Status: closed Resolution: out of date
Dependencies: Superseder:
Assigned To: Nosy List: vstinner
Priority: normal Keywords:

Created on 2021-06-14 07:36 by vstinner, last changed 2021-09-21 18:38 by vstinner. This issue is now closed.

Messages (2)
msg395779 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2021-06-14 07:36
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.
msg402345 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2021-09-21 18:38
I didn't see this failure recently. I close the issue as out of date.
History
Date User Action Args
2021-09-21 18:38:41vstinnersetstatus: open -> closed
resolution: out of date
messages: + msg402345

stage: resolved
2021-06-14 07:37:08vstinnersettitle: test_threading: test_print_exception() hangs and killed after 3h15 -> test_threading: test_print_exception() hangs and killed after 3h15 on AMD64 Windows8.1 Refleaks 3.9
2021-06-14 07:36:56vstinnercreate