-
-
Notifications
You must be signed in to change notification settings - Fork 227
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
Paratest hangs indefinitely with WrapperRunner and SqliteRunner #431
Comments
I've encountered myself this behaviour many time. Yes we need to better handle wrapper/sqlite runners errors. |
we've the same issue. one worker seems to never stop running. |
Hi @timglabisch , have you tried the latest version of ParaTest, currently 5? |
@Slamdunk i am using ^3.1 - i'll try upgrading. |
@Slamdunk seems that we've the same issue with with the latest version. it seems to depend on the order of the tests and i guess it is related to error output. we only ran into this issue when an error occurred. the problem is that the worker never stops and idl's on a wait4. |
If you could debug it a bit and pinpoint some lines, I would try to investigate it further. |
@Slamdunk i think i figured out the reason. the output pipe of the child process overflows and the child could not write more to the pipe. the child process simply blocks on a print but the parent process never reads the pipe. i used an old paratest / phpunit version to test this but i guess it's the same for the current version. trace where it hangs:
in the end in my case it hangs exacly here (PHPUnit\Util\Printer->write()): i've to look at the paratest code, but i guess the solution is to consume the pipes. |
The default behavior of paratest is to wrap Phpuni execution between ob_start and ob_get_clean: paratest/bin/phpunit-wrapper.php Line 73 in 5dc3a09
What you are telling me it's weird |
@Slamdunk we have a slightly modified wrapper code. i have to take a closer look at it to rule out that it is due to our test setup. but basically it would make sense to read out the output buffer of the children. private function waitForAllToFinish(): void
{
do {
foreach ($this->workers as $key => $worker) {
if (!$worker->isRunning()) {
unset($this->workers[$key]);
}
}
$worker->updateStateFromAvailableOutput(); // <<<<<<
usleep(10000);
$this->printOutput();
} while (\count($this->workers) > 0);
} you may could try to print huge amount of data in tests. (and may disable the output buffer). |
I have never liked the way Nevertheless, still I can't figure out how calling paratest/bin/phpunit-wrapper.php Lines 45 to 57 in b2a1695
if you call In the meantime I suggest you to use |
@Slamdunk seems to be reproducible now, would you takeover the issue? |
I'll dig into it 👍 |
@Slamdunk did you already worked on this issue? |
I'm on #526 which will some many issues, including this one |
Please see #310 as another reported case of this. I'm unsure of why this was closed.
I've spent a little time digging further into this issue and I've identified what I think is the issue. Paratest hangs after, what seems to be all tests, having completed. Upon inspection, after the completion of these tests, it appears PHPUnit also has 3 processes still in the process queue with PID assignment. The number of phpunit processes still left dangling and the number of errors reported in the paratest output are the same.
After debugging the phpunit-wrapper bin script, I've noticed that the
$lastExitCode
for the commandPHPUnit\TextUI\Command::main(false)
is2
in all of these cases. In these cases an Exception has been thrown.It seems to me that, when Exceptions are being thrown and the exit status of phpunit within the
phpunit-wrapper
is not zero, that the processes aren't being handled properly.I can manually add something like...
to the
phpunit-wrapper
within the while loop, but, this of course does not allow for the tests to complete before printing the error. However, it's far better than having the paratest process hang indefinitely, never printing out any error details.The funny thing is, if I alter the settings for phpunit.xml to not
stopOnError
, paratest never completes and ends up hanging much earlier in the process of tests.Firstly, what is the preferred
phpunit.xml
config for paratest? It doesn't seem that any configuration is entirely compatible.And also, any insights into the process management for these
phpunit-wrapper
scripts? If they're terminating with an exit code, how is paratest interpreting this? It doesn't seem that the processes are exited in this case and if they are, paratest interprets this as a failure and exits itself.The text was updated successfully, but these errors were encountered: