sticky-socket-cluster icon indicating copy to clipboard operation
sticky-socket-cluster copied to clipboard

"bind EACCES undefined" when creating a worker after another died

Open muriloinflue opened this issue 7 years ago • 0 comments

Error: bind EACCES undefined
    at Object.exports._errnoException (util.js:870:11)
    at exports._exceptionWithHostPort (util.js:893:20)
    at cb (net.js:1302:16)
    at rr (cluster.js:594:14)
    at Worker.<anonymous> (cluster.js:564:9)
    at process.<anonymous> (cluster.js:714:8)
    at emitTwo (events.js:92:20)
    at process.emit (events.js:172:7)
    at handleMessage (internal/child_process.js:689:10)
    at Pipe.channel.onread (internal/child_process.js:440:11)
Worker died (ID: 3, PID: 8080), port: undefined

The problem is that, at least for me, the worker variable inside the cluster.on.exit event doesn't have a port attribute... so when calling the fork_worker(worker.port), it passes as undefined.

I fixed it by adding it as an atribute right after creating the worker on the fork_worker. Maybe that can help someone out there.

var fork_worker = function(port)
{
    var worker = cluster.fork({worker_port: port});
    worker.port = port;
};

muriloinflue avatar Apr 17 '18 12:04 muriloinflue