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)
This commit is contained in:
Arnaud Le Blanc 2023-01-13 17:43:17 +01:00 committed by GitHub
parent 0f7625c47c
commit 8c0698f66b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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] ?? '') !== '') {