Skip to content

Commit 1328fa3

Browse files
authored
gh-110393: Remove watchdog with hardcoded timeout (#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.
1 parent d33aa18 commit 1328fa3

File tree

2 files changed

+0
-9
lines changed

2 files changed

+0
-9
lines changed

Lib/test/test_builtin.py

-2
Original file line numberDiff line numberDiff line change
@@ -2203,8 +2203,6 @@ def _run_child(self, child, terminal_input):
22032203
if pid == 0:
22042204
# Child
22052205
try:
2206-
# Make sure we don't get stuck if there's a problem
2207-
signal.alarm(2)
22082206
os.close(r)
22092207
with open(w, "w") as wpipe:
22102208
child(wpipe)

Lib/test/test_socketserver.py

-7
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,6 @@
3232
HAVE_FORKING = test.support.has_fork_support
3333
requires_forking = unittest.skipUnless(HAVE_FORKING, 'requires forking')
3434

35-
def signal_alarm(n):
36-
"""Call signal.alarm when it exists (i.e. not on Windows)."""
37-
if hasattr(signal, 'alarm'):
38-
signal.alarm(n)
39-
4035
# Remember real select() to avoid interferences with mocking
4136
_real_select = select.select
4237

@@ -68,12 +63,10 @@ class SocketServerTest(unittest.TestCase):
6863
"""Test all socket servers."""
6964

7065
def setUp(self):
71-
signal_alarm(60) # Kill deadlocks after 60 seconds.
7266
self.port_seed = 0
7367
self.test_files = []
7468

7569
def tearDown(self):
76-
signal_alarm(0) # Didn't deadlock.
7770
reap_children()
7871

7972
for fn in self.test_files:

0 commit comments

Comments
 (0)