]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.11] gh-110393: Remove watchdog with hardcoded timeout (GH-110400) (#110444)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Thu, 5 Oct 2023 22:05:20 +0000 (15:05 -0700)
committerGitHub <noreply@github.com>
Thu, 5 Oct 2023 22:05:20 +0000 (22:05 +0000)
gh-110393: Remove watchdog with hardcoded timeout (GH-110400)

test_builtin and test_socketserver no longer use signal.alarm() to
implement a watchdog with a hardcoded timeout (2 and 60 seconds).
Python test runner regrtest has two watchdogs: faulthandler and
timeout on running worker processes. Tests using short hardcoded
timeout can fail on slowest buildbots just because the timeout is too
short.
(cherry picked from commit 1328fa31fe9c72748fc6fd11d017c82aafd48a49)

Co-authored-by: Victor Stinner <vstinner@python.org>
Lib/test/test_builtin.py
Lib/test/test_socketserver.py

index 2f56121616629e948ccce1d18026a4aacb1bf281..d6edc2b431d32a7afd60f3d0776c71dfd785f3e4 100644 (file)
@@ -2146,8 +2146,6 @@ class PtyTests(unittest.TestCase):
         if pid == 0:
             # Child
             try:
-                # Make sure we don't get stuck if there's a problem
-                signal.alarm(2)
                 os.close(r)
                 with open(w, "w") as wpipe:
                     child(wpipe)
index 2edb1e0c0e21e2c0f1736258cfa0b5f472648a99..80e1968c0bf67625ddb3b3562829df0109b6627e 100644 (file)
@@ -33,11 +33,6 @@ requires_unix_sockets = unittest.skipUnless(HAVE_UNIX_SOCKETS,
 HAVE_FORKING = test.support.has_fork_support
 requires_forking = unittest.skipUnless(HAVE_FORKING, 'requires forking')
 
-def signal_alarm(n):
-    """Call signal.alarm when it exists (i.e. not on Windows)."""
-    if hasattr(signal, 'alarm'):
-        signal.alarm(n)
-
 # Remember real select() to avoid interferences with mocking
 _real_select = select.select
 
@@ -77,12 +72,10 @@ class SocketServerTest(unittest.TestCase):
     """Test all socket servers."""
 
     def setUp(self):
-        signal_alarm(60)  # Kill deadlocks after 60 seconds.
         self.port_seed = 0
         self.test_files = []
 
     def tearDown(self):
-        signal_alarm(0)  # Didn't deadlock.
         reap_children()
 
         for fn in self.test_files: