Skip to content Skip to sidebar Skip to footer

Phantomjs-node Crashes When Attempting To Scale Behind Node-cluster

Associated GitHub issue: https://github.com/sgentle/phantomjs-node/issues/280 I have a simple app that does the following: var phantom = require('phantom'), express = requi

Solution 1:

I tried with this gist and I'm able to create the phantom browser and to get a response.

  • If I run two tabs on localhost:3000/foo, the second will be spawned only when the first has ended.
  • If I run more than two concurrent requests in my browser (chrome), I get the error too.
    • If I try to run more requests (from a bash) than the number of clusters it crashes.
  • If I run requests (less than or equal to the number of cluster) from a bash script it doesn't crash at all.

    Also, I'm noticing that with the bash script I'm running everything in concurrence:

    http GET localhost:3000/foo &
    http GET localhost:3000/foo &
    http GET localhost:3000/foo &
    http GET localhost:3000/foo &
    

The error you're seeing comes from this assertion:

  assert(worker.id in this.all === false);

Meaning that the worker is not in the round robin anymore.

I don't think that this is direclty related to PM2 but there is a bug. PM2 should not crash. I suggest your report an issue by quoting this stackoverflow. Not sure that it can be fixed if it's a node bug though.

Sadly there are no fix for this at the moment but you can take a look at a nodejs issue. I've read that iojs fixed this, maybe you can give it a try ;).

Another related stackoverflow: NodeJS Cluster unexpected assert.AssertionError.


Post a Comment for "Phantomjs-node Crashes When Attempting To Scale Behind Node-cluster"