2

I use nodejs cluster

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

if (cluster.isMaster) {
   for (var i = 0; i < numCPUs; i++){
      var worker = cluster.fork();
      worker.on('exit', function(code, signal) {
        console.log("worker was killed by signal: " + signal);
      });
   }
}

And sometimes with different time intervals i have a error

worker was killed by signal: SIGSEGV

What this error mean and why she called? node version v0.11.14-pre, Debian

Giffo
  • 4,161
  • 3
  • 15
  • 16

1 Answers1

0

Don't know exactly the answer but think this could help.

Using phantomJs I was getting sometimes the same error (changing worker for signal). The situation: I was opening a page using phantomJs; when the body was ready I want a callback to be called, then I was closing phantom. grosso modo my code was:

phantom.create(function (ph) {
  ...
  callbackDone(result);
  ph.exit();
});

Doing so, the exception was:

 signal killed phantomjs: SIGSEGV

At this point I realized it was breaking just for heavy callback tasks. In order words, if the callback function before exit() was a light one: everything was fine; but in different conditions it crashes.

The solution: close the object before the callback:

  ph.exit();
  callbackDone(result);
Manu Artero
  • 9,238
  • 6
  • 58
  • 73