phantomjs exit() doesn't terminate the process

2020-05-18 05:20发布

问题:

I've been using phantom.js on Windows 7 for quite some time now (I think v1.4.0 was the first version I used) and everything was always fine. But for some reason the process isn't properly terminated any longer when calling phantom.exit() and I absolutely don't know why.

The problem started to occur in v1.7.0, from one day to another. Everything once worked fine in 1.7.0 but then it did no more. Even after upgrading to 1.8.0 and now 1.9.0 it still doesnt work. The console just hangs. I can't type anything, phantomjs.exe is still listed in the list of processes in the taskmanager, even CTRL+C doesn't do anything. The whole thing is just frozen.

The underscore in the console blinks as if it expected more input but I can't type anything. The only chance I have is to close the cmd window using the [X] button which is totally dumb for automated testing.

I use the precompiled binaries I downloaded from http://phantomjs.org/ and as I said: it stopped working from one day to another. I even reinstalled it a few times, even to different folders but the process just doesn't get terminated any longer. Anyone who has an idea what the problem could be?

回答1:

This is a known issue with the Nvidia drivers when you have two cards. To resolve this issue you need to select "High-performance NVidia processor" in the NVidia control panel (NVidia Control Panel > Manage 3D Settings > Global Settings).

Read more here: https://github.com/ariya/phantomjs/issues/10845