From 2975642a7a9d2b820856c5e3e821b7cb539b5d36 Mon Sep 17 00:00:00 2001 From: Brown Date: Thu, 30 May 2019 14:10:22 -0400 Subject: [PATCH] Ignore task done message error --- src/Psalm/Internal/Fork/Pool.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Psalm/Internal/Fork/Pool.php b/src/Psalm/Internal/Fork/Pool.php index 0778cc63e..ae7b7929e 100644 --- a/src/Psalm/Internal/Fork/Pool.php +++ b/src/Psalm/Internal/Fork/Pool.php @@ -133,7 +133,8 @@ class Pool $task_result = $task_closure($i, $task_data); $task_done_message = new ForkTaskDoneMessage($task_result); $serialized_message = base64_encode(serialize($task_done_message)) . PHP_EOL; - fwrite($write_stream, $serialized_message); + // don’t care if this message doesn’t get through + @fwrite($write_stream, $serialized_message); } // Execute each child's shutdown closure before @@ -143,7 +144,11 @@ class Pool // Serialize this child's produced results and send them to the parent. $process_done_message = new ForkProcessDoneMessage($results ?: []); $serialized_message = base64_encode(serialize($process_done_message)) . PHP_EOL; - fwrite($write_stream, $serialized_message); + $bytes_written = @fwrite($write_stream, $serialized_message); + if (strlen($serialized_message) !== $bytes_written) { + error_log('Could not send ForkProcessDoneMessage to parent process, terminating.'); + exit(self::EXIT_FAILURE); + } fclose($write_stream); @@ -264,11 +269,6 @@ class Pool // If the stream has closed, stop trying to select on it. if (feof($file)) { - if ($content[intval($file)] !== '') { - error_log('Child did not send full message before closing the connection'); - $this->did_have_error = true; - } - fclose($file); unset($streams[intval($file)]); }