Skip to content
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

Process Isolation does not work when PHPDBG is used #3772

Closed
sanmai opened this issue Aug 2, 2019 · 10 comments
Closed

Process Isolation does not work when PHPDBG is used #3772

sanmai opened this issue Aug 2, 2019 · 10 comments
Labels
type/bug Something is broken

Comments

@sanmai
Copy link
Contributor

sanmai commented Aug 2, 2019

Q A
PHPUnit version 8.3.0, 8.3.1 (8.2.x are not affected)
PHP version 7.4.0beta1 (cli) (built: Jul 27 2019 01:44:06) ( ZTS )
Installation Method Composer

git bisect between 8.3.0 and 8.2.5 points at 69e61bb

Steps to reproduce:

git clone https://github.com/Ocramius/ProxyManager
cd ProxyManager/
git checkout -b phpdbg-fault 72c2cdf3a0c98b3c6c7253a300979d0f877afcee
composer install --ignore-platform-reqs

docker run -it --rm -v "$PWD":/opt/ProxyManager -w /opt/ProxyManager php:7.4.0beta1-zts-buster \
    phpdbg -qrr vendor/bin/phpunit --verbose \
    tests/ProxyManagerTest/GeneratorStrategy/FileWriterGeneratorStrategyTest.php

Observe:

PHPUnit 8.3.0 by Sebastian Bergmann and contributors.

Runtime:       PHPDBG 7.4.0beta1
Configuration: /opt/ProxyManager/phpunit.xml.dist

EEEE                                                                                                                                         4 / 4 (100%)

Time: 195 ms, Memory: 8.00 MB

There were 4 errors:

1) ProxyManagerTest\GeneratorStrategy\FileWriterGeneratorStrategyTest::testGenerate
PHPUnit\Framework\Exception: [Nothing to execute!]

Caused by
ErrorException: unserialize(): Error at offset 0 of 33 bytes in /opt/ProxyManager/vendor/phpunit/phpunit/src/Util/PHP/AbstractPhpProcess.php:271
Stack trace:
#0 [internal function]: PHPUnit\Util\PHP\AbstractPhpProcess::PHPUnit\Util\PHP\{closure}(8, 'unserialize(): ...', '/opt/ProxyManag...', 271, Array)
#1 /opt/ProxyManager/vendor/phpunit/phpunit/src/Util/PHP/AbstractPhpProcess.php(271): unserialize('\e[1;31m[Nothing...')
#2 /opt/ProxyManager/vendor/phpunit/phpunit/src/Util/PHP/AbstractPhpProcess.php(170): PHPUnit\Util\PHP\AbstractPhpProcess->processChildResult(Object(ProxyManagerTest\GeneratorStrategy\FileWriterGeneratorStrategyTest), Object(PHPUnit\Framework\TestResult), '\e[1;31m[Nothing...', '')
#3 /opt/ProxyManager/vendor/phpunit/phpunit/src/Framework/TestCase.php(676): PHPUnit\Util\PHP\AbstractPhpProcess->runTestJob('<?php declare(s...', Object(ProxyManagerTest\GeneratorStrategy\FileWriterGeneratorStrategyTest), Object(PHPUnit\Framework\TestResult))
#4 /opt/ProxyManager/vendor/phpunit/phpunit/src/Framework/TestSuite.php(568): PHPUnit\Framework\TestCase->run(Object(PHPUnit\Framework\TestResult))
#5 /opt/ProxyManager/vendor/phpunit/phpunit/src/TextUI/TestRunner.php(616): PHPUnit\Framework\TestSuite->run(Object(PHPUnit\Framework\TestResult))
#6 /opt/ProxyManager/vendor/phpunit/phpunit/src/TextUI/Command.php(201): PHPUnit\TextUI\TestRunner->doRun(Object(PHPUnit\Framework\TestSuite), Array, true)
#7 /opt/ProxyManager/vendor/phpunit/phpunit/src/TextUI/Command.php(160): PHPUnit\TextUI\Command->run(Array, true)
#8 /opt/ProxyManager/vendor/phpunit/phpunit/phpunit(61): PHPUnit\TextUI\Command::main()
#9 {main}

Accidentally, [Nothing to execute!] is what phpdbg reports in certain circumstances.

The test case with the error is tagged with @runTestsInSeparateProcesses.

@sebastianbergmann
Copy link
Owner

I will not look into this myself but will, of course, review and possibly merge a pull request that addresses this. Because of PCOV and its significant performance improvements not only over Xdebug but also over PHPDBG I do not care enough about PHPDBG anymore to debug problems such as this one.

@sanmai
Copy link
Contributor Author

sanmai commented Aug 2, 2019

No questions about PCOV, but if PHPDBG is not supported anymore in 8.3.0, is it going to make sense to warn about that? Or even make a full stop.

@sanmai
Copy link
Contributor Author

sanmai commented Aug 2, 2019

I'm sorry to go back and worth about this issue, but if PHPDBG is not supposed to work with process isolation (triggered by @runTestsInSeparateProcesses like in this case, or otherwise), is it better be blunt about that incompatibility, what do you think?

@sebastianbergmann
Copy link
Owner

Does it work with PHP(DBG) 7.3? If it does then this is not a critical issue right now as PHP 7.4 has not been released yet.

@sanmai
Copy link
Contributor Author

sanmai commented Aug 2, 2019

Neither I do think this is anywhere critical. Please feel free to prioritize this issue as you see fit.

I'll try to get back to this issue sometime later, and if the problem goes away, I'll close it.

@sebastianbergmann sebastianbergmann changed the title Possible phpdbg incompatibility with 8.3.0 on PHP 7.4 Process Isolation does not work when PHPDBG 7.4 is used Aug 2, 2019
@sanmai
Copy link
Contributor Author

sanmai commented Aug 2, 2019

FWIW git bisect between 8.3.0 and 8.2.5 points at 69e61bb

I've did the bisect twice, and it still points there. I'll do it again now. Edit: still point there.

@ADmad
Copy link

ADmad commented Aug 2, 2019

We are seeing same error with phpdbg with PHP 7.2 too

https://travis-ci.org/cakephp/cakephp/jobs/566976783

ADmad added a commit to cakephp/cakephp that referenced this issue Aug 2, 2019
ADmad added a commit to cakephp/cakephp that referenced this issue Aug 2, 2019
@sebastianbergmann sebastianbergmann changed the title Process Isolation does not work when PHPDBG 7.4 is used Process Isolation does not work when PHPDBG is used Aug 2, 2019
@sebastianbergmann sebastianbergmann added the type/bug Something is broken label Aug 2, 2019
@ADmad
Copy link

ADmad commented Aug 2, 2019

That said I am happy to encounter this bug, helped me discover pcov 🙂.

@Ocramius
Copy link
Sponsor Contributor

Ocramius commented Aug 4, 2019

To be clear, I'd love to use pcov/xdebug with 7.4 while peeking into newer PHP releases, but that never works due to those projects not targeting PHP until it's fully released. This is the one big advantage of phpdbg, being a SAPI that is directly evolving with the language itself. This problem will pop up with any future language release (and yep, I know that I'm a super-early adopter - we wouldn't notice a lot of bugs otherwise)

@sebastianbergmann
Copy link
Owner

I reverted 69e61bb in dc2365b for PHPUnit 8.3.4 (not released yet).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/bug Something is broken
Projects
None yet
Development

No branches or pull requests

4 participants