MinkZombieDriver icon indicating copy to clipboard operation
MinkZombieDriver copied to clipboard

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

Open jmauerhan opened this issue 8 years ago • 10 comments

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.

jmauerhan avatar Apr 13 '16 12:04 jmauerhan

What if you try on Linux?

aik099 avatar Apr 13 '16 13:04 aik099

It does not happen on Linux, no.

jmauerhan avatar Apr 17 '16 23:04 jmauerhan

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?

DerTee avatar Mar 25 '17 07:03 DerTee

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

jmauerhan avatar Apr 25 '17 17:04 jmauerhan

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"
    }
}

yaronyg avatar Jul 17 '17 22:07 yaronyg

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).

aik099 avatar Jul 18 '17 06:07 aik099

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.

yaronyg avatar Jul 18 '17 15:07 yaronyg

@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

DerTee avatar Jul 28 '17 01:07 DerTee

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.

yaronyg avatar Jul 28 '17 15:07 yaronyg

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

sdiebel avatar Nov 15 '19 18:11 sdiebel