Skip to content

Commit 4134036

Browse files
[3.11] gh-110393: Remove watchdog with hardcoded timeout (GH-110400) (#110444)
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 1328fa3) Co-authored-by: Victor Stinner <[email protected]>
1 parent 331d90f commit 4134036

File tree

2 files changed

+0
-9
lines changed

2 files changed

+0
-9
lines changed

Lib/test/test_builtin.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2146,8 +2146,6 @@ def _run_child(self, child, terminal_input):
21462146
if pid == 0:
21472147
# Child
21482148
try:
2149-
# Make sure we don't get stuck if there's a problem
2150-
signal.alarm(2)
21512149
os.close(r)
21522150
with open(w, "w") as wpipe:
21532151
child(wpipe)

Lib/test/test_socketserver.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,6 @@
3333
HAVE_FORKING = test.support.has_fork_support
3434
requires_forking = unittest.skipUnless(HAVE_FORKING, 'requires forking')
3535

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

@@ -77,12 +72,10 @@ class SocketServerTest(unittest.TestCase):
7772
"""Test all socket servers."""
7873

7974
def setUp(self):
80-
signal_alarm(60) # Kill deadlocks after 60 seconds.
8175
self.port_seed = 0
8276
self.test_files = []
8377

8478
def tearDown(self):
85-
signal_alarm(0) # Didn't deadlock.
8679
reap_children()
8780

8881
for fn in self.test_files:

0 commit comments

Comments
 (0)