Skip to content

Commit 8d86c07

Browse files
committed
Add retries for unaccepted worker connections
1 parent 7e29d26 commit 8d86c07

File tree

1 file changed

+13
-2
lines changed
  • graalpython/com.oracle.graal.python.test/src

1 file changed

+13
-2
lines changed

graalpython/com.oracle.graal.python.test/src/runner.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -727,6 +727,8 @@ def run_in_subprocess_and_watch(self):
727727
port = server.getsockname()[1]
728728
assert port
729729

730+
retries = 3
731+
730732
while self.remaining_test_ids and not self.stop_event.is_set():
731733
last_remaining_count = len(self.remaining_test_ids)
732734
with open(tmp_dir / 'out', 'w+') as self.out_file:
@@ -744,8 +746,17 @@ def run_in_subprocess_and_watch(self):
744746
cmd.append('--failfast')
745747
self.process = subprocess.Popen(cmd, stdout=self.out_file, stderr=self.out_file)
746748

747-
server.settimeout(600.0)
748-
with server.accept()[0] as sock:
749+
server.settimeout(180.0)
750+
try:
751+
sock = server.accept()[0]
752+
except TimeoutError:
753+
interrupt_process(self.process)
754+
retries -= 1
755+
if retries:
756+
continue
757+
sys.exit("Worker failed to connect to runner multiple times")
758+
759+
with sock:
749760
conn = Connection(sock)
750761

751762
conn.send([TestSpecifier(t.test_file, t.test_name) for t in self.remaining_test_ids])

0 commit comments

Comments
 (0)