Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PhantomJS exited unexpectedly with exit code -1073741819

I run a bunch of Jasmine specs with PhantomJS (via Grunt) on a Windows 7 PC, and I happen to get the following error:

Testing jasmine specs via phantom
......
Running PhantomJS...ERROR
>> 0 [ '' ]
Warning: PhantomJS exited unexpectedly with exit code -1073741819. Use --force to continue.
Aborted due to warnings.

The error does not appear if I delete a bunch of tests; however I have no idea what causes the error.

What I also find strange, it that it only occurs now and then.

Any idea why this happens?

like image 834
Helge Avatar asked Aug 15 '13 15:08

Helge


Video Answer


2 Answers

We are running AngularJS tests via jasmine and grunt, and had this very same problem. For us it turned out to be due to our custom $exceptionHandler function.

We were missing the throw exception line that is in the example handler. By not throwing the exception, the test would pass but it would randomly cause PhantomJS to crash.

This means that some of our tests were failing and we didn't know it!

Here's the sample handler from the $exceptionHandler documentation page:

angular.module('exceptionOverride', []).factory('$exceptionHandler', function          () {
  return function (exception, cause) {
    exception.message += ' (caused by "' + cause + '")';
    throw exception; // <--- This is important
  };
});

So I'd look and see if you have custom exception handling too and are possibly missing the throw exception line. I hope it's as simple as that for you too!

like image 140
Austin Thompson Avatar answered Nov 09 '22 15:11

Austin Thompson


(Sadly, I don't have an answer. I would post as a comment, but I don't have the rep.)

I'm getting the same error trying to create html snapshots with grunt-html-snapshot.

Running PhantomJS...ERROR
>> 0 [ '' ]
Warning: PhantomJS exited unexpectedly with exit code -1073741819. Use --force to continue.

Aborted due to warnings.

I'm feeding grunt a list of URLs and I "randomly" get this crash somewhere in the list. I think I have traced it to the child process spawn call that launches phantom.exe with the bridge.js script. It doesn't seem to get as far as trying load the next page before the phantom.exe child process exits with the error. I haven't been able to find any documentation on the error code.

like image 26
user3233032 Avatar answered Nov 09 '22 14:11

user3233032