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

Tests pass, but throw a FatalError at end (Curl error thrown for http DELETE to /session/xxxxxx) #544

Open
mpiot opened this issue Apr 19, 2022 · 6 comments

Comments

@mpiot
Copy link

mpiot commented Apr 19, 2022

When I run tests using Panther, all check pass, but the return code is not 0 because a fatal error is thrown at the end. When I run it from my machine this error is reached randomly, on CI machines (self-hosted, github-hosted) it's near 100% of the times.

PHPUnit 9.5.20 #StandWithUkraine

Testing 
..........                                                        10 / 10 (100%)

Time: 02:23.562, Memory: 211.00 MB

OK (10 tests, 71 assertions)

Remaining indirect deprecation notices (11)

  2x: Since gesdinet/jwt-refresh-token-bundle 1.0: The "firewall" node is deprecated without replacement.
    2x in AppWebTestCase::_resetDatabase from App\Tests

  2x: Since gesdinet/jwt-refresh-token-bundle 1.0: The "user_provider" node is deprecated without replacement.
    2x in AppWebTestCase::_resetDatabase from App\Tests

  1x: The "DAMA\DoctrineTestBundle\Doctrine\DBAL\AbstractStaticDriver" class implements "Doctrine\DBAL\VersionAwarePlatformDriver" that is deprecated All drivers will have to be aware of the server version in the next major release.
    1x in PHPUnitExtension::executeBeforeFirstTest from DAMA\DoctrineTestBundle\PHPUnit

  1x: Since gesdinet/jwt-refresh-token-bundle 1.0: The "Gesdinet\JWTRefreshTokenBundle\Entity\AbstractRefreshToken" class is deprecated, use "Gesdinet\JWTRefreshTokenBundle\Model\AbstractRefreshToken" instead.
    1x in AppWebTestCase::_resetDatabase from App\Tests

  1x: The "Symfony\Bridge\Doctrine\Logger\DbalLogger" class implements "Doctrine\DBAL\Logging\SQLLogger" that is deprecated Use {@see \Doctrine\DBAL\Logging\Middleware} or implement {@see \Doctrine\DBAL\Driver\Middleware} instead.
    1x in AppWebTestCase::_resetDatabase from App\Tests

  1x: Method "Symfony\Component\EventDispatcher\EventSubscriberInterface::getSubscribedEvents()" might add "array" as a native return type declaration in the future. Do the same in implementation "Stof\DoctrineExtensionsBundle\EventListener\BlameListener" now to avoid errors or add an explicit @return annotation to suppress this message.
    1x in AppWebTestCase::_resetDatabase from App\Tests

  1x: Method "Symfony\Component\EventDispatcher\EventSubscriberInterface::getSubscribedEvents()" might add "array" as a native return type declaration in the future. Do the same in implementation "Stof\DoctrineExtensionsBundle\EventListener\LoggerListener" now to avoid errors or add an explicit @return annotation to suppress this message.
    1x in AppWebTestCase::_resetDatabase from App\Tests

  1x: Method "JsonSerializable::jsonSerialize()" might add "mixed" as a native return type declaration in the future. Do the same in implementation "Facebook\WebDriver\Firefox\FirefoxOptions" now to avoid errors or add an explicit @return annotation to suppress this message.
    1x in ProcessControllerE2ETest::testAddStep from App\Tests\Controller\ProductDevelopment\Probe

  1x: The "Facebook\WebDriver\Local\LocalWebDriver::createBySessionID()" method will require a new "bool $isW3cCompliant" argument in the next major version of its parent class "Facebook\WebDriver\Remote\RemoteWebDriver", not defining it is deprecated.
    1x in ProcessControllerE2ETest::testAddStep from App\Tests\Controller\ProductDevelopment\Probe

PHP Fatal error:  Uncaught Facebook\WebDriver\Exception\WebDriverCurlException: Curl error thrown for http DELETE to /session/27efacf1a6c0ed11e569bc5e75f757e2

Failed to connect to 127.0.0.1 port 9515: Connection refused in /home/mpiot/Documents/apps/vendor/php-webdriver/webdriver/lib/Remote/HttpCommandExecutor.php:333
Stack trace:
#0 /home/mpiot/Documents/apps/vendor/php-webdriver/webdriver/lib/Remote/RemoteWebDriver.php(585): Facebook\WebDriver\Remote\HttpCommandExecutor->execute()
#1 /home/mpiot/Documents/apps/vendor/php-webdriver/webdriver/lib/Remote/RemoteWebDriver.php(312): Facebook\WebDriver\Remote\RemoteWebDriver->execute()
#2 /home/mpiot/Documents/apps/vendor/symfony/panther/src/Client.php(582): Facebook\WebDriver\Remote\RemoteWebDriver->quit()
#3 /home/mpiot/Documents/apps/vendor/symfony/panther/src/Client.php(108): Symfony\Component\Panther\Client->quit()
#4 [internal function]: Symfony\Component\Panther\Client->__destruct()
#5 {main}
  thrown in /home/mpiot/Documents/apps/vendor/php-webdriver/webdriver/lib/Remote/HttpCommandExecutor.php on line 333

Fatal error: Uncaught Facebook\WebDriver\Exception\WebDriverCurlException: Curl error thrown for http DELETE to /session/27efacf1a6c0ed11e569bc5e75f757e2

Failed to connect to 127.0.0.1 port 9515: Connection refused in /home/mpiot/Documents/apps/vendor/php-webdriver/webdriver/lib/Remote/HttpCommandExecutor.php:333
Stack trace:
#0 /home/mpiot/Documents/apps/vendor/php-webdriver/webdriver/lib/Remote/RemoteWebDriver.php(585): Facebook\WebDriver\Remote\HttpCommandExecutor->execute()
#1 /home/mpiot/Documents/apps/vendor/php-webdriver/webdriver/lib/Remote/RemoteWebDriver.php(312): Facebook\WebDriver\Remote\RemoteWebDriver->execute()
#2 /home/mpiot/Documents/apps/vendor/symfony/panther/src/Client.php(582): Facebook\WebDriver\Remote\RemoteWebDriver->quit()
#3 /home/mpiot/Documents/apps/vendor/symfony/panther/src/Client.php(108): Symfony\Component\Panther\Client->quit()
#4 [internal function]: Symfony\Component\Panther\Client->__destruct()
#5 {main}
  thrown in /home/mpiot/Documents/apps/vendor/php-webdriver/webdriver/lib/Remote/HttpCommandExecutor.php on line 333
@gravitiq-cm
Copy link

Any insight into what causes this or how to fix it?

@mpiot
Copy link
Author

mpiot commented Aug 18, 2022

Hi, in my case I've do a shell script that handle the execution of phpunit, and override the return code by reading the message of phpunit. This is only a workarround, because don't know why this issue appear.

#/bin/sh
result=$(symfony php vendor/bin/phpunit | tee /dev/stderr)

if echo "$result" | grep -E 'OK \([0-9]+ test'; then
    exit 0;
fi

exit 1

@gravitiq-cm
Copy link

I'm not using phpunit... I'm just using Symfony\Component\Panther\Client::createFirefoxClient(); and running things from there. It all works, except for the fatal errors at the end (after everything has finished, so I guess related to the destructor or connection closing).

@gravitiq-cm
Copy link

Maybe we could add some setting on Client to tell it not to call $this->webDriver->close() from Client::close()?

mtorromeo added a commit to mtorromeo/panther that referenced this issue Aug 21, 2022
mtorromeo added a commit to mtorromeo/panther that referenced this issue Aug 21, 2022
@ThomasLandauer
Copy link
Contributor

Probably related to (or same as): #466

@KorvinSzanto
Copy link

KorvinSzanto commented Feb 16, 2024

I get around this in my pest tests by doing:

$client = null;

afterEach(function () use (&$client) {
    if ($client !== null) {
        try {
            $client = null;
        } catch (\Throwable $e) {
        }
    }
});

test('some test', function() use (&$client) {
    $client = Client::createChromeClient();
    ...
});

It's odd that I only see this sometimes using panther.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants