24

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?

phantom screenshot after calling phantom.exit()

Manuel Bieh
  • 751
  • 1
  • 9
  • 19
  • you provide an example in REPL mode ? is it only for this mode ? Note that, from team, "this is a new functionality and it's built making all sorts of Javascript manipulation: there are bugs" – Cybermaxs Jun 03 '13 at 13:39

1 Answers1

47

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

Vitaly Slobodin
  • 1,359
  • 12
  • 10
  • 1
    Wow, it works! Thank you! I've been looking for a solution for quite a long time now! – Manuel Bieh Jun 10 '13 at 21:15
  • 9
    In case you don't want to change global settings, it can be done for phantomjs.exe only through (NVidia Control Panel > Manage 3D Settings > Program Settings) and selecting phantomjs.exe as the program and high-performance NVidia processor as the preferred graphics processor. – Hisham Dec 09 '13 at 04:28
  • You sir, just saved me a headache. Thank you! – Jon Sheppard Mar 28 '14 at 17:15
  • 8
    this is one of the weirdest cause-effect bugs I have yet seen! :D – Maciej Jankowski Apr 30 '14 at 20:03
  • 1
    And for ladies and gentlemen using C#, make sure you call Quit or Dispose, not Close: http://stackoverflow.com/q/15067107/681538 – Alex Oct 03 '14 at 13:28
  • 1
    How can you figured it out ?!? `:)` – albciff Dec 06 '14 at 22:05