Why are nose tests leaving orphaned PhantomJS processes on Windows 8?

151 views Asked by At

I have some Python Selenium nose tests running on Windows 8 with PhantomJS. I installed Chutzpah (PhantomJS) via Chocolatey.

When I run the nose tests, a "ShimGen" process appears and lots of "PhantomJS is a headless WebKit with JavaScript API (32 bit)" processes appear and use 50+mb of memory and never close. This causes a lot of stuck PhantomJS processes in memory.

This eventually brings down the server.

2

There are 2 answers

0
Zymotik On

In the C:\ProgramData\chocolatey\bin directory was a phantomjs.exe executable. Renaming this to phantomjs.exe.bak and adding C:\ProgramData\chocolatey\lib\Chutzpah to the Windows path instead solved the problem.

It appears that this exe is a shim to the phantomjs executable in the bin folder. When terminate is called, I don't think it is properly handled by the shim. I got the idea to try this from this url: Choco issue: Shims should terminate the underlying process they are waiting on when they receive a termination signal

In case you are wondering, this is how to edit your Windows path:

Start >> Right click computer >> Properties >> Advanced Tab >> Environment Variables: In System variables pane select Path and click Edit

0
ferventcoder On

What version of choco did you use to install PhantomJS (and what version of PhantomJS)? I believe we corrected this issue in most cases, but it is on newer versions of choco - and you need the shim to be generated in that newer version (which means install or upgrade, but we are adding a shim regen command).