question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

PhantomJS sometimes crashes

See original GitHub issue

I have been successfully running a fairly comprehensive suite of Protractor e2e tests using Chrome on OSX (Mavericks: 10.9.2).

We have a technical requirement to run these tests headlessly, so I swapped in PhantomJS instead of Chrome, and after 20 seconds (consistently), I get the following error:

Runner Process Exited With Error Code: 8
Fatal error: protractor exited with code: 1

Now for some more detailed information.

Here is the full error output from the grunt task I am running:

Running "protractor:phantomjs" (protractor) task
------------------------------------
PID: 9678 (capability: phantomjs #1)
------------------------------------
Starting selenium standalone server...
Selenium standalone server started at http://192.168.1.111:4444/wd/hub
/path/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:1562
throw error;
^
UnknownError: null
at new bot.Error (/path/node_modules/protractor/node_modules/selenium-webdriver/lib/atoms/error.js:109:18)
at Object.bot.response.checkResponse (/path/node_modules/protractor/node_modules/selenium-webdriver/lib/atoms/response.js:106:9)
at /path/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/webdriver.js:135:24
at /path/node_modules/protractor/node_modules/selenium-webdriver/lib/goog/base.js:1178:15
at webdriver.promise.ControlFlow.runInNewFrame_ (/path/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:1455:20)
at notify (/path/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:328:12)
at notifyAll (/path/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:297:7)
at fulfill (/path/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:402:7)
at /path/node_modules/protractor/node_modules/selenium-webdriver/lib/goog/base.js:1178:15
at webdriver.promise.ControlFlow.runInNewFrame_ (/path/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:1455:20)
==== async task ====
    WebDriver.createSession()
at Function.webdriver.WebDriver.acquireSession_ (/path/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/webdriver.js:132:49)
at Function.webdriver.WebDriver.createSession (/path/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/webdriver.js:111:30)
at Builder.build (/path/node_modules/protractor/node_modules/selenium-webdriver/builder.js:105:20)
at LocalDriverProvider.getDriver (/path/node_modules/protractor/lib/driverProviders/local.dp.js:128:9)
at /path/node_modules/protractor/lib/runner.js:327:35
at _fulfilled (/path/node_modules/protractor/node_modules/q/q.js:797:54)
at self.promiseDispatch.done (/path/node_modules/protractor/node_modules/q/q.js:826:30)
at Promise.promise.promiseDispatch (/path/node_modules/protractor/node_modules/q/q.js:759:13)
at /path/node_modules/protractor/node_modules/q/q.js:573:44
    [launcher] Runner Process Exited With Error Code: 8
>>
Fatal error: protractor exited with code: 1

Package versions:

"grunt-protractor-runner": "~0.2.3"
"protractor": "0.19.0"
"selenium-webdriver": "~2.40"

Contents of protractor.conf.js:

exports.config = {
    seleniumServerJar: '../../node_modules/protractor/selenium/selenium-server-standalone-2.39.0.jar',
    seleniumPort: 4444,
    seleniumArgs: ['-browserTimeout=60'],
    specs: [
        '../e2e/utils.js',
        '../e2e/**/*-suite.js'
    ],
    capabilities: {
        browserName: 'phantomjs',
        'phantomjs.binary.path': './node_modules/karma-phantomjs-launcher/node_modules/phantomjs/bin/phantomjs',
        'phantomjs.cli.args': ['--debug=true', '--webdriver', '--webdriver-logfile=webdriver.log', '--webdriver-loglevel=DEBUG']
    },
    baseUrl: 'http://localhost:9292',
    rootElement: 'body',
    onPrepare: function () {
        require('jasmine-reporters');
        jasmine.getEnv().addReporter(new jasmine.JUnitXmlReporter('test/results/', true, true));
    },
    framework: 'jasmine',
    jasmineNodeOpts: {
        onComplete: function () {
        },
        isVerbose: true,
        showColors: true,
        includeStackTrace: true,
        defaultTimeoutInterval: 30000
    }
};

I have tried installing version ~1.9.7-1 of the phantomjs package independently of the one that protractor depends upon, and updating the phantomjs.binary.path property in protractor.conf.js, but I get the same result.

After spending far too long debugging the JS to try to isolate where the error is occurring, I know that it is falling over in runner.js.

Specifically in Runner.prototype.runJasmine_(), the anonymous function passed to webdriver.promise.controlFlow().execute() here is never executed.

Can anyone help?

Let me know if you need more information.

Matt

Issue Analytics

  • State:closed
  • Created 10 years ago
  • Comments:61 (27 by maintainers)

github_iconTop GitHub Comments

1reaction
NickTomlincommented, Apr 10, 2016

I’ll go ahead and close the loop here because upgrading to PhantomJS 2 resolves this 👏 👏 🎊 🎺

I’d also like to restate what Julie mentioned earlier:

Protractor does NOT test against PhantomJS in our CI environment, and while we’ll try to address issues and look at pull requests that improve PhantomJS problems, it is not a high issue for the core team to work on personally.

If anyone encounters additional issues with Phantom, please try to raise an issue on the Phantom queue and resolve it there. Thanks, y’all are awesome! 😺

0reactions
heroandtn3commented, Apr 9, 2016

Yes, this is fixed by upgrade to PhantomJS 2 https://github.com/detro/ghostdriver/issues/328#issuecomment-44309690

Read more comments on GitHub >

github_iconTop Results From Across the Web

Crash Reporting - PhantomJS
This page contains information about what to do if PhantomJS crashes. ... If you have a crash that only happens occasionally and is...
Read more >
PhantomJS crashes after 150-180 urls - Stack Overflow
Seems like the problem lies into the 2.0 version. Tested 1.9.8 out of frustration and - it works, 60% less RAM used, no...
Read more >
Why Phantomjs got crashed while running more test cases?
PhantomJS notoriously has a lot of memory issues and will crash after a certain amount of memory use. I have dealt with this...
Read more >
A Tesla in 'full-self-driving' mode caused an 8-car crash in ...
Tesla's unexpected "phantom braking" problem caused an eight-car pileup, according to CNN. NHTSA is already investigating the phenomenon known ...
Read more >
Comunità di Steam :: METAL GEAR SOLID V: THE PHANTOM PAIN
I cant play the game (I haven't even got to the actual game play) for more than five minutes before the game just...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found