You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When a process generates large amounts of output in a short time, the Process component can potentially ignore information which is buffered for reading. This appears to be because each readStreams() call reads only the first 8192 bytes of the data in the buffer for a particular pipe. I would expect that (on termination at least) all the remaining data is read from a pipe before closing.
This issue is also present if a single call to getOutput() is issued after the loop terminates. This issue becomes intermittent if the usleep() in the while loop below is omitted as a race condition is created between termination of the process and performing the next read.
This will only be present when generating large amounts of output. For programs which output less data, the number of calls to updateStatus() over the process lifetime will be sufficient to read all the output.
Code to reproduce:
$process = new Process('cat /etc/services');
$process->start();
while ($process->isRunning()) {
echo $process->getIncrementalOutput();
usleep(100);
}
echo $process->getIncrementalOutput();
As an experiment, I modified the readStreams() call in the ProcessPipes class to read using the following code:
After this modification I was no longer able to reproduce the issue. I have not done a thorough investigation as to whether there is additional impact from a change such as this.
The text was updated successfully, but these errors were encountered:
Move back to `post-create-project-cmd` event.
Bash expression for random salt is probably affected by:
symfony/symfony#9409
`cat /dev/urandom` outputs a very large amount of data.
Trying with external file
…efore process termination (astephens25)
This PR was merged into the 2.3 branch.
Discussion
----------
[Process] Fixed data in pipe being truncated if not read before process termination
| Q | A
| ------------- | ---
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #9409
| License | MIT
| Doc PR | N/A
This is a repeat of the botched pull request #9630.
Commits
-------
7e51913 Fixed data in pipe being truncated if not read before process termination
When a process generates large amounts of output in a short time, the Process component can potentially ignore information which is buffered for reading. This appears to be because each
readStreams()
call reads only the first 8192 bytes of the data in the buffer for a particular pipe. I would expect that (on termination at least) all the remaining data is read from a pipe before closing.This issue is also present if a single call to
getOutput()
is issued after the loop terminates. This issue becomes intermittent if theusleep()
in the while loop below is omitted as a race condition is created between termination of the process and performing the next read.This will only be present when generating large amounts of output. For programs which output less data, the number of calls to
updateStatus()
over the process lifetime will be sufficient to read all the output.Code to reproduce:
As an experiment, I modified the
readStreams()
call in theProcessPipes
class to read using the following code:After this modification I was no longer able to reproduce the issue. I have not done a thorough investigation as to whether there is additional impact from a change such as this.
The text was updated successfully, but these errors were encountered: