I am running my node server in centos6.X, and forking a child process.
var cp = require('child_process');
child = cp.fork(__dirname+'/worker');
child.on('exit', function (code, signal) {
console.log('Child exited with code = ' +code+' signal = '+signal);
});
but after few seconds I get this error
Child exited with code = null signal = SIGKILL
I am now clueless how to get rid of this, there is no more trace, as to what is happening.
more clarification
I have put console.logs in worker and they are getting printed. the worker is now waiting for message from main server. but exits after waiting for few seconds. I also run the worker js independently with node command and there it does not exit.
The same code works fine on my local OSX laptop. but on cloud centos6.X I am facing this issue.
.fork
nodejs API but I think it takes in a module, which I think would typically be a.js
file that has something likemodule.export
? How does yourworker
file look like? Or maybe you may have missed the.js
bit?