minkphp / MinkZombieDriver

Zombie.js driver for Mink framework
41 stars 49 forks source link

Warning: socket_read(): unable to read from socket [10054]: An existing connection was forcibly closed by the remote host. #169

Open jmauerhan opened 8 years ago

jmauerhan commented 8 years ago

I have tried using the Mink Zombie Driver on it's own, and as part of BehatMinkDriverExtension, and both ways I get this. After a test successfully passes and the test suite ends, I get this PHP warning:

PHP Warning: socket_read(): unable to read from socket [10054]: An existing connection was forcibly closed by the remote host.
in ***\vendor\behat\mink-zombie-driver\src\NodeJS\Connection.php on line 89

I'm not quite sure where to start on debugging or providing more info, so please ask for whatever and I'll try to provide it :)

I am using Windows 7

Composer require:

  "require": {
    "behat/behat": "^3.0",
    "behat/mink": "^1.7",
    "behat/mink-goutte-driver": "^1.2",
    "behat/mink-extension": "^2.2",
    "sensiolabs/behat-page-object-extension": "^2.0@dev",
    "grovolearning/silva2": "*@dev",
    "beberlei/assert": "^2.5",
    "behat/mink-zombie-driver": "^1.4"
  },

I also tried using it with the page objects extension and that doesn't work at all - at least this way, it works, but I get a PHP warning.

aik099 commented 8 years ago

What if you try on Linux?

jmauerhan commented 8 years ago

It does not happen on Linux, no.

DerTee commented 7 years ago

I get the exact same warning. My composer.json is also very similar:

    "require-dev": {
        "phpunit/phpunit": "^5.7",
        "phpunit/dbunit": "^2.0",
        "behat/mink": "^1.7",
        "behat/mink-goutte-driver": "^1.2",
        "behat/mink-zombie-driver": "^1.4",
        "phpunit/phpunit-mink-trait": "^1.0"
    },
    "require": {
        "mbostock/d3": "^3.5"
    }
}

I attached my full stacktrace. stacktrace_socketerror_win7.txt

Also I use windows 7. Maybe it's an actual error in the socket implementation of PHP/Windows?

jmauerhan commented 7 years ago

I have upgraded to Windows 10 since submitting this, I'll see if its still a problem for me.

yaronyg commented 7 years ago

My stack trace:

Warning: socket_read(): unable to read from socket [10054]: An existing connection was forcibly closed by the remote host.
 in C:\depots\MyFirstProject\tests\vendor\behat\mink-zombie-driver\src\NodeJS\Connection.php on line 89

My composer.json:

{
    "require-dev": {
        "behat/behat": "^3.3",
        "behat/mink": "^1.7",
        "behat/mink-extension": "^2.2",
        "behat/mink-goutte-driver": "^1.2",
        "behat/mink-zombie-driver": "1.4.x-dev"
    }
}
aik099 commented 7 years ago

Maybe some of tested pages are taking too long to load and Zombie is dropping the connection? After #183 is merged you'll be able to specify timeout option for Zombie to wait longer for problematic pages to load.

Maybe the socket handling code can be improved to reconnect when broken socket is detected, but once connected we can't really restore browser state (e.g. opened page).

yaronyg commented 7 years ago

BTW, the previous stack was on Windows. And what's interesting is that all the tests pass. So the pages did load successfully. It seems like the error only occurs during clean up. I checked the exit code returned by behat and it is set based on the tests passing, the warning doesn't seem to matter.

DerTee commented 7 years ago

@yaronyg Did you get that error on windows 7 or another windows version?

It's a weird error and I can't reproduce it reliably. As you can see by this screenshot it works sometimes, but closing the browser or similar actions doesn't do the trick all the time: mink-problems-with-zombie-driver

yaronyg commented 7 years ago

So I was seeing this on a windows 10 image in Azure. But I haven't seen this is a bit because I stopped using zombiedriver since it turned out our tests didn't need it. I just ran the tests again on my personal Windows 10 machine and made one of the tests use Zombie (by adding @javascript) and it repo'd.

sdiebel commented 4 years ago

Your posts are two years ago and no answer; I have the same problem. Maybe cause of empty string but don't know how to solve theis problem. I even have @socket_read but the error is E_WARNING :-( any help