Fix ProcessJsonRpcClient never clearing the Process output buffers#103
Open
poman wants to merge 1 commit into
Open
Fix ProcessJsonRpcClient never clearing the Process output buffers#103poman wants to merge 1 commit into
poman wants to merge 1 commit into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #102
ProcessJsonRpcClient::readProcessOutput()read newly produced bytes from the Node bridge process withProcess::getIncrementalOutput()/getIncrementalErrorOutput(), but never called the matchingProcess::clearOutput()/clearErrorOutput(). Symfony'sProcesskeeps the entire stdout/stderr history in an internal buffer (a php://temp stream that spills to a disk-backed temp file past a small in-memory threshold) for as long as the process object is alive — the incremental getters only track a read cursor, they do not discard what was already consumed.On a long-lived session (a multi-hour Behat regression run, for example) every JSON-RPC response — page HTML, base64 screenshots, ARIA snapshots — accumulated forever in that buffer. Once the temp file grew large enough to fill the available disk space,
Process::addOutput()started silently failing to write further bytes, and every subsequent request inwaitForResponse()spun until its deadline and failed with the genericJSON-RPC request N timed out— indistinguishable from a slow browser action or a genuine hang.Fixes it by calling
clearOutput()/clearErrorOutput()right after each incremental read, so the Process buffers stay empty; nothing else reads the accumulated (non-incremental) output.Testing
ProcessJsonRpcClient(testReadProcessOutputClearsBothProcessBuffers,testReadProcessOutputClearsBuffersAcrossMultiplePolls) assertingclearOutput()/clearErrorOutput()are called once per poll — verified both fail against the pre-fix code (0 calls observed) and pass with the fix.php-cs-fixer --dry-runclean;phpstan analyse(level 10) reports 0 errors on the changed files.Discovered while running the OroCommerce Behat regression suite on this driver: several nodes started failing late in the run with unexplained
JSON-RPC request N timed outerrors, traced back to full CI-node disks.