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

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

Open
jmauerhan opened this issue Apr 13, 2016 · 10 comments

Comments

@jmauerhan
Copy link

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
Copy link
Member

aik099 commented Apr 13, 2016

What if you try on Linux?

@jmauerhan
Copy link
Author

It does not happen on Linux, no.

@DerTee
Copy link

DerTee commented Mar 25, 2017

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
Copy link
Author

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

@yaronyg
Copy link

yaronyg commented Jul 17, 2017

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
Copy link
Member

aik099 commented Jul 18, 2017

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
Copy link

yaronyg commented Jul 18, 2017

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
Copy link

DerTee commented Jul 28, 2017

@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
Copy link

yaronyg commented Jul 28, 2017

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
Copy link

sdiebel commented Nov 15, 2019

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

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

5 participants