Skip to content

Commit 8c0698f

Browse files
authored
Fix run-tests.php hanging when a worker process dies without notice (#9931)
run-tests.php with `-jN` can hang if a parallel worker dies without notice. This can happen due to fatal errors in the worker, or if the worker is killed. - run-tests.php (main process) \_ run-tests.php (worker #0) // main process hangs if this one crashes \_ test-001.php (test-001.phpt)
1 parent 0f7625c commit 8c0698f

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

run-tests.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1583,6 +1583,10 @@ function run_all_tests_parallel(array $test_files, array $env, $redir_tested): v
15831583
kill_children($workerProcs);
15841584
error("Could not find worker stdout in array of worker stdouts, THIS SHOULD NOT HAPPEN.");
15851585
}
1586+
if (feof($workerSock)) {
1587+
kill_children($workerProcs);
1588+
error("Worker $i died unexpectedly");
1589+
}
15861590
while (false !== ($rawMessage = fgets($workerSock))) {
15871591
// work around fgets truncating things
15881592
if (($rawMessageBuffers[$i] ?? '') !== '') {

0 commit comments

Comments
 (0)