]> granicus.if.org Git - python/commitdiff
Issue #25277: Set a timeout of 10 minutes in test_eintr using faulthandler to
authorVictor Stinner <victor.stinner@gmail.com>
Thu, 1 Oct 2015 11:16:43 +0000 (13:16 +0200)
committerVictor Stinner <victor.stinner@gmail.com>
Thu, 1 Oct 2015 11:16:43 +0000 (13:16 +0200)
try to debug a hang on the FreeBSD 9 buildbot.

Run also eintr_tester.py with python "-u" command line option to try to get the
full output on hang/crash.

Lib/test/eintrdata/eintr_tester.py
Lib/test/test_eintr.py

index e1e0d91006f7348594387a472d0f65a9b25feeb2..443ccd543369467f2792b68a1705b558b064353f 100644 (file)
@@ -9,6 +9,7 @@ sub-second periodicity (contrarily to signal()).
 """
 
 import contextlib
+import faulthandler
 import io
 import os
 import select
@@ -50,6 +51,9 @@ class EINTRBaseTest(unittest.TestCase):
         signal.setitimer(signal.ITIMER_REAL, cls.signal_delay,
                          cls.signal_period)
 
+        # Issue #25277: Use faulthandler to try to debug a hang on FreeBSD
+        faulthandler.dump_traceback_later(10 * 60, exit=True)
+
     @classmethod
     def stop_alarm(cls):
         signal.setitimer(signal.ITIMER_REAL, 0, 0)
@@ -58,6 +62,7 @@ class EINTRBaseTest(unittest.TestCase):
     def tearDownClass(cls):
         cls.stop_alarm()
         signal.signal(signal.SIGALRM, cls.orig_handler)
+        faulthandler.cancel_dump_traceback_later()
 
     @classmethod
     def _sleep(cls):
index d3cdda04e6944587218b69727202b9443abb49ee..75452f2d413e4d9c9a303ae3410158d2327d5c0c 100644 (file)
@@ -16,7 +16,8 @@ class EINTRTests(unittest.TestCase):
         # Run the tester in a sub-process, to make sure there is only one
         # thread (for reliable signal delivery).
         tester = support.findfile("eintr_tester.py", subdir="eintrdata")
-        script_helper.assert_python_ok(tester)
+        # use -u to try to get the full output if the test hangs or crash
+        script_helper.assert_python_ok("-u", tester)
 
 
 if __name__ == "__main__":