Skip to content
This repository has been archived by the owner on May 30, 2023. It is now read-only.

Using PhantomJs inside of clustering in an Express app causes AssertionError #13237

Closed
RavenHursT opened this issue May 15, 2015 · 3 comments
Closed
Labels

Comments

@RavenHursT
Copy link

Having trouble setting up a server that will allow me to visit webpages in phantom to do some tests on them (verify pixel calls are being made etc.).

Everything works as expected as long as I don't try to use node-cluster. I can make multiple requests to the endpoint and the processes never error out. But the moment I add clustering, the first request works just fine, but the second request always errors out and kills the script on page.create() and I get the following error in the node console:

assert.js:86
  throw new assert.AssertionError({
        ^
AssertionError: false == true
    at RoundRobinHandle.add (cluster.js:140:3)
    at queryServer (cluster.js:480:12)
    at Worker.onmessage (cluster.js:438:7)
    at ChildProcess.<anonymous> (cluster.js:692:8)
    at ChildProcess.emit (events.js:129:20)
    at handleMessage (child_process.js:324:10)
    at Pipe.channel.onread (child_process.js:352:11)

I'm rather new at this clustering stuff so I'm sure I'm doing something wrong.

Here's some code similar to what I'm trying to accomplish:

var numCPUs = require('os').cpus().length;
var cluster = require('cluster');

if (cluster.isMaster) {
    for (var i = 0; i < numCPUs; i++) {
        cluster.fork();
    }

    cluster.on('exit', function() {
        cluster.fork();
    });
} else {
    var
        express = require('express'),
        serve = express(),
        phantom = require('phantom');

    serve.get('/cs-rt-test-suite', function (req, res) {
        phantom.create();
    });
    serve.listen(8888);
}
@Darijusch
Copy link

are you using node 0.10.38 or 0.11.x/0.12.x ?
i downgraded back to 0.10.x to get rid of this bug, node is really buggy since 0.11.0

@RavenHursT
Copy link
Author

@Darijusch, thought about doing that.. but I have other modules that depend on 0.12.x so I'm kinda stuck.. 👎

@stale stale bot added the stale label Dec 27, 2019
@stale
Copy link

stale bot commented Dec 30, 2019

Due to our very limited maintenance capacity, we need to prioritize our development focus on other tasks. Therefore, this issue will be automatically closed (see #15395 for more details). In the future, if we see the need to attend to this issue again, then it will be reopened. Thank you for your contribution!

@stale stale bot closed this as completed Dec 30, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants