[Python-checkins] cpython: test_eintr: try to debug hang on FreeBSD

victor.stinner python-checkins at python.org
Wed Sep 2 17:33:31 CEST 2015


https://hg.python.org/cpython/rev/ebccac60b9e7
changeset:   97582:ebccac60b9e7
user:        Victor Stinner <victor.stinner at gmail.com>
date:        Wed Sep 02 17:19:04 2015 +0200
summary:
  test_eintr: try to debug hang on FreeBSD

files:
  Lib/test/eintrdata/eintr_tester.py |  8 ++++++++
  1 files changed, 8 insertions(+), 0 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
@@ -8,6 +8,7 @@
 sub-second periodicity (contrarily to signal()).
 """
 
+import faulthandler
 import io
 import os
 import select
@@ -36,10 +37,17 @@
         cls.orig_handler = signal.signal(signal.SIGALRM, lambda *args: None)
         signal.setitimer(signal.ITIMER_REAL, cls.signal_delay,
                          cls.signal_period)
+        if hasattr(faulthandler, 'dump_traceback_later'):
+            # Most tests take less than 30 seconds, so 15 minutes should be
+            # enough. dump_traceback_later() is implemented with a thread, but
+            # pthread_sigmask() is used to mask all signaled on this thread.
+            faulthandler.dump_traceback_later(15 * 60, exit=True)
 
     @classmethod
     def stop_alarm(cls):
         signal.setitimer(signal.ITIMER_REAL, 0, 0)
+        if hasattr(faulthandler, 'cancel_dump_traceback_later'):
+            faulthandler.cancel_dump_traceback_later()
 
     @classmethod
     def tearDownClass(cls):

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


More information about the Python-checkins mailing list