Repository navigation
Conversation
…sts run in parallel and the time limit works Reading an empty pipe blocks on Windows before PHP 8.5, so a running test blocks the others and its time limit is not enforced. fstat() of the pipe tells how many bytes wait in it, so only those are read, at most 64 KB at once. fstat() calls GetFileInformationByHandle(), which is not documented for pipes. pipe-probe.php verifies the behaviour once in its own process before the first test. If it fails, or fstat() fails later, the output is read as before.
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.
On Windows with PHP < 8.5, reading an empty pipe blocks. A running test therefore blocks the others until it writes something or ends, and the time limit (
--timeout,@timeout) is not enforced.fstat()of the pipe returns the number of bytes waiting in it without blocking, so Job reads only those, at most 64 KB per check. Nothing changes on other platforms and on PHP 8.5+.fstat()callsGetFileInformationByHandle(), which Microsoft does not document for pipes. Sopipe-probe.phpchecks the behaviour once, in its own process with a 5 s limit, before the first test starts (the probe does not count towards that test). If it fails, Job reads as before. Iffstat()fails later, that test and the tests started after it are read as before, without the time limit; tests already running keep reading without blocking. It costs about 0.1 s and two processes once per run.PHP 8.1.34, Windows 11,
-j 8, median of 10 runs:The "before" and "after" columns were measured in separate series on the same machine. Large output depends on the timer resolution: with a 1 ms timer, 8 × 4 MB takes 0.68 s before and 0.31 s after.
-j 1without a time limit is not changed.Known limits:
fstat()kept reporting fewer bytes than are in the pipe, the probe would not notice it, and a test writing a lot would wait in its write until its time limit.Runner.pipes.phptruns only on Windows with PHP < 8.5.Tests: the new ones pass on Windows 11 with PHP 8.1–8.6, NTS and ZTS; with a probe that fails, the tests that need it are skipped and the others pass. They take about 8 s on Windows < 8.5 and 25 s on 8.5+, where they test the existing code (
Job.output.phptis slow there because of php/php-src#25763). PHPStan fails as on master (DomQuery).This PR and #470 change neighbouring lines of
Job.php, so the one merged second will need a rebase.