From 8c0698f66bbaa87de56e38ace03466c9e0c2f2bd Mon Sep 17 00:00:00 2001 From: Arnaud Le Blanc Date: Fri, 13 Jan 2023 17:43:17 +0100 Subject: [PATCH] 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) --- run-tests.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/run-tests.php b/run-tests.php index 16241c08cc6..edfab1f57ad 100755 --- a/run-tests.php +++ b/run-tests.php @@ -1583,6 +1583,10 @@ escape: kill_children($workerProcs); error("Could not find worker stdout in array of worker stdouts, THIS SHOULD NOT HAPPEN."); } + if (feof($workerSock)) { + kill_children($workerProcs); + error("Worker $i died unexpectedly"); + } while (false !== ($rawMessage = fgets($workerSock))) { // work around fgets truncating things if (($rawMessageBuffers[$i] ?? '') !== '') {