[Python-checkins] cpython: Issue #25277: Set a timeout of 10 minutes in test_eintr using faulthandler to

victor.stinner python-checkins at python.org
Thu Oct 1 07:17:14 EDT 2015


https://hg.python.org/cpython/rev/10efb1797e7b
changeset:   98464:10efb1797e7b
user:        Victor Stinner <victor.stinner at gmail.com>
date:        Thu Oct 01 13:16:43 2015 +0200
summary:
  Issue #25277: Set a timeout of 10 minutes in test_eintr using faulthandler to
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.

files:
  Lib/test/eintrdata/eintr_tester.py |  5 +++++
  Lib/test/test_eintr.py             |  3 ++-
  2 files changed, 7 insertions(+), 1 deletions(-)


diff --git a/Lib/test/eintrdata/eintr_tester.py b/Lib/test/eintrdata/eintr_tester.py
--- a/Lib/test/eintrdata/eintr_tester.py
+++ b/Lib/test/eintrdata/eintr_tester.py
@@ -9,6 +9,7 @@
 """
 
 import contextlib
+import faulthandler
 import io
 import os
 import select
@@ -50,6 +51,9 @@
         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 @@
     def tearDownClass(cls):
         cls.stop_alarm()
         signal.signal(signal.SIGALRM, cls.orig_handler)
+        faulthandler.cancel_dump_traceback_later()
 
     @classmethod
     def _sleep(cls):
diff --git a/Lib/test/test_eintr.py b/Lib/test/test_eintr.py
--- a/Lib/test/test_eintr.py
+++ b/Lib/test/test_eintr.py
@@ -16,7 +16,8 @@
         # 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__":

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list