From: Victor Stinner Date: Wed, 2 Sep 2015 15:19:04 +0000 (+0200) Subject: test_eintr: try to debug hang on FreeBSD X-Git-Tag: v3.6.0a1~1702 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=177b8eb34fed9a299ad00cea8e8be45fd836ab91;p=python test_eintr: try to debug hang on FreeBSD --- diff --git a/Lib/test/eintrdata/eintr_tester.py b/Lib/test/eintrdata/eintr_tester.py index f755880514..73711a47b0 100644 --- a/Lib/test/eintrdata/eintr_tester.py +++ b/Lib/test/eintrdata/eintr_tester.py @@ -8,6 +8,7 @@ Signals are generated in-process using setitimer(ITIMER_REAL), which allows sub-second periodicity (contrarily to signal()). """ +import faulthandler import io import os import select @@ -36,10 +37,17 @@ class EINTRBaseTest(unittest.TestCase): 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):