From deab44eef721cf1b7ac6af88fd95c4ffbf7e9351 Mon Sep 17 00:00:00 2001 From: Joseph Parsons Date: Wed, 16 Oct 2019 10:09:26 -0500 Subject: [PATCH] Pool: read process output to avoid hang state with large output --- src/Pool.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Pool.php b/src/Pool.php index 31000743..afdc4305 100644 --- a/src/Pool.php +++ b/src/Pool.php @@ -137,6 +137,12 @@ public function wait(?callable $intermediateCallback = null): array if ($process instanceof SynchronousProcess) { $this->markAsFinished($process); } + + /* + * There are likely better solutions here, but basically, without this line, we enter a hang state if the output is sufficiently large (I'm assuming larger than the stdout buffer size). + * So if we configure our pool to support large outputs, but don't actually attempt to read the output here, then the child process never exists, SIGCHILD never fires, and our pool never closes. + */ + $process->getOutput(); } if (! $this->inProgress) {