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

[Bug] Error when closing Mink session on Windows #130

Open
csarrazi opened this issue Mar 23, 2015 · 10 comments
Open

[Bug] Error when closing Mink session on Windows #130

csarrazi opened this issue Mar 23, 2015 · 10 comments

Comments

@csarrazi
Copy link

When stopping the server, the Connection class throws the following warning:

Warning: socket_read() [function.socket-read]: unable to read from socket [0]: Une connexion existante a dû être fermée par l'hôte distant.

As well as a RuntimeException with the following message: "unable to kill the process".

Removing the following line from the abstract Server class actually fixes the issue.

$this->doEvalJS($this->getConnection(), 'process.exit(0);');

Seems to me that Node's runtime is actually faster than PHP, and for that reason, the node server actually closes the connection when running the server's stop() method. This means that the connection as well as the process are closed:

  • The socket is being read / closed. Which throws the initial warning
  • The process is actually killed. Which throws the error with the Process component.
@aik099
Copy link
Member

aik099 commented Mar 23, 2015

I thought that used Symfony's Process component should be dealing with that kind of errors.

I'm not sure if stopping the Mink session, that used Zombie driver would actually terminate the Zombie's NodeJS process. Are you certain?

@csarrazi
Copy link
Author

I only described the behavior on Windows. I can't reproduce the isue on Linux.

On windows, it seems terminating the Symfony process actually kills the node process too. It seems to be the same on linux, too.

Of course, I'm only speaking about the behavior when doing a return or die statement after a successful initialization of the session. On linux, it works fine.

Another thing: When there is an error in the main process (for example if ZombieDriver::triggerBrowserEvent() fails for an unknown reason), the sub-process still runs in the background, and prevents the next run.

Another thing (but not related to this issue). On Linux (didn't try on windows yet as I only use a windows box at work for one of my clients), the sub-process is not killed if there is an error in the main process. This means the node process is still running in the background if there was an error while runing some code. I'll also investigate a little bit more on this second issue (or make a separate issue).

@aik099
Copy link
Member

aik099 commented Mar 23, 2015

Another thing: When there is an error in the main process (for example if ZombieDriver::triggerBrowserEvent() fails for an unknown reason), the sub-process still runs in the background, and prevents the next run.

We already have an issue for this: #120 . It's missing a PR though.

Another thing (but not related to this issue). On Linux (didn't try on windows yet as I only use a windows box at work for one of my clients), the sub-process is not killed if there is an error in the main process. This means the node process is still running in the background if there was an error while runing some code. I'll also investigate a little bit more on this second issue (or make a separate issue).

Isn't this the same as above issue?

@aik099
Copy link
Member

aik099 commented Mar 23, 2015

@stof , apparently Zombie now can be used on Windows. Can you please look into that?

@csarrazi
Copy link
Author

Another thing (but not related to this issue). On Linux (didn't try on windows yet as I only use a windows box at work for one of my clients), the sub-process is not killed if there is an error in the main process. This means the node process is still running in the background if there was an error while runing some code. I'll also investigate a little bit more on this second issue (or make a separate issue).

Isn't this the same as above issue?

Actually, yeah. I went back and forth while writing my message, so I actually repeated myself. Sorry about that!

And yeah, Zombie can indeed be used on windows. It requires VS2010/12/13 to be installed on the machine, to compile the native node module.

@stof
Copy link
Member

stof commented Mar 24, 2015

@aik099 will try to check with my old computer when I have time (I'm on Ubuntu since september)

@aik099
Copy link
Member

aik099 commented Mar 24, 2015

We should post that somewhere: Can't use Zombie, because you're on Windows? Switch to Ubuntu! :)

@aik099
Copy link
Member

aik099 commented Mar 24, 2015

I wasn't able to install Zombie on Windows myself.

@csarrazi , can you clarify on what VS2010/12/13 is? Is it Visual Studio? Do I need to install whole Visual Studio just to get Zombie to compile?

@csarrazi
Copy link
Author

Visual Studio. And yes, you need at least Visual Studio Express.

@csarrazi
Copy link
Author

Oh, and you may run into issues when compiling node-gyp if you use a visual studio >2010, if you don't specify the visual studio version using

npm config set msvs_version 2012 --global (or 2013, if you use VS2k13)

Oh yeah, it's a real pain in the ***. ;)

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

3 participants