-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Parallel test improvements #3851
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
840fdfc
to
a7b190b
Compare
d01e1a4
to
43b6cb9
Compare
43b6cb9
to
d138568
Compare
1958bb4
to
3e508a1
Compare
@weltling @cmb69 There are some Windows specific failures here that I can't figure out. The failing tests are
In the current setup, what happens is that all the windows_mb_path tests themselves do not run in parallel (i.e. no two windows_mb_path tests will run at the same time). However other tests run in parallel to the windows_mb_path tests. Which tests run can be seen in the AppVeyor log from the Do you have any ideas why these failures happen? Can it be that that the codepage settings bleed over across processes with a common parent or something? |
run-tests.php
Outdated
|
||
escape: | ||
while ($testDirsToGo || ($testDirsInProgress > 0)) { | ||
while ($test_files || $testsInProgress > 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why test_files and not testFiles?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$test_files
is an existing variable. Would have to touch a lot of code (which all seems to use underscore style) to rename it.
The |
If/when this is merged, please squash it. |
I have not been able to reproduce the Windows test failures on my machine. Will have a closer look tomorrow. |
@@ -6,9 +6,9 @@ if (!extension_loaded('sockets')) { | |||
die('SKIP sockets extension not available.'); | |||
} | |||
$s = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP); | |||
$br = socket_bind($s, '0.0.0.0', 58381); | |||
$br = socket_bind($s, '0.0.0.0', 58379); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it make sense to declare CONFLICTS for this tests based on the used port number?
That way you dont need to check the whole codebase which tests use which port
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's better to adjust the test (if it's very simple, like here), as it allows it to run in parallel. Adding a port-based CONFLICT would prevent spurious failures, but reduce parallelization opportunities.
In the future we might want to switch code to use dynamic port assignment instead (this is what HHVM did in their tests), but that's a lot more effort than changing a fixed port :)
@staabm I think checking the codebase gradually is worth while as it allows better parallelization in the long run |
8cae72a
to
d87c1a3
Compare
I've merged the conflict handling implementation in c0e15a3. Keeping this open until the Windows issue is resolved. I'll probably experimentally enable use of |
I've enabled Also got a SOAP failure that I can't reproduce from that (https://travis-ci.org/php/php-src/jobs/495937131):
It looks like we're reading garbage from |
That garbage looks like the gzipped post from server019.phpt. |
@pcrov Ooooh, thanks, that makes a lot of sense. "uniq"id strikes again: https://github.com/php/php-src/blob/master/run-tests.php#L1967 |
@nikic Sorry for the delay; still handicaped by a flu. Anyhow, it seems to me, that for CLI API, the codepage is set for the console which is inherited by all these processes. Therefore we're facing these race-conditions. I don't see a way to fix this, but to mark the respective tests, which appear to be many, as conflicting. :( |
For the purposes of test parallelization I guess the solution will be to add an extra mode where a test conflicts with everything and thus enforce that no other tests may run in parallel with it. This behavior seems pretty broken to me though. It means that it's impossible to safely switch PHP's internal CP, because it will also always switch the console CP as well (on CLI that is). |
6b339eb
to
9cff793
Compare
I agree that the inherent coupling of the internal and console CP is a limitation which we may want to abolish sometime, but for most practical purposes it appears not to be a problem. After all, it's better than having no way to influence the CP as it was in PHP 7.0. :) Thanks for taking care of the test framework work-around, anyway! |
9cff793
to
4b99d5f
Compare
Using |
It looks like the failures with no output always occur in the |
I though that a single OPcache instance would be used for all test processes. :S |
@cmb69 At least on Linux it's going to be a separate one for each test (shm opcache is never shared on cli sapi). Is that different on Windows? |
At least two instances of the built-in Webserver would share a single SHM Cache. |
@cmb69 Interesting, didn't know that opcache behaves so differently on Windows. Do you know if there's any way to avoid this? Looking at shared_alloc_win32.c probably not -- seems like the only way to get a separate cache is to switch users? |
It should be possible to change the temporary directory to enforce a new mmap file; can give that a try later. PS: no, that won't work ("Unable to open base address file"). |
4b99d5f
to
38d38eb
Compare
38d38eb
to
0bd27bd
Compare
@cmb69 I've now tried to set a per-worker TEMP, TMP and TMPDIR. It does create separate base address files in that case. However, it still tries to use the same base address (wat?). I then tried explicitly setting |
Guess that comment explains it: php-src/ext/opcache/shared_alloc_win32.c Lines 283 to 285 in a72c741
|
Most likely this Opcache scenario will need to be covered, as we want to support the parallel tests with Opcache as well. The current expectation is, that same user would run on just one instance of the shared memory. This approach might have to be changed to support an arbitrary number of separate Opcache instances for the same user. It is a complex topic though, which needs a careful consideration. It involves both shared memory and mutex handling. I can imagine, why is was done the way it is right now - having automatic namings has an advantage of less user errors and thus less false bug reports. Possible hard configuration mistakes can impact security and system stability. Some conversations about this happened in the past, which might be useful to read https://bugs.php.net/bug.php?id=72645. Thanks. |
Going to close this testing PR. The current state is that parallel testing is enabled on Travis, and the non-opcache job on AppVeyor. I'm stilling fixing occasional failures, but generally the functionality seems fairly stable :) |
This a) reenables IO capture tests by inheriting std streams from the main process and b) implements the
--CONFLICTS--
mechanism mentioned in #2822.Some more CONFLICTS very likely missing, but I hope that we can start using this in CI and fix issues as they come up.
cc @hikari-no-yume