Node 10.14.0/10.15.3
Windows 10 Pro 64/CentOS 7.6.18.10
Example of code:
public static sendMasterRequest(data: ClusterMasterRequest): void {
if (!cluster.isMaster) throw new Error('Only Master can use sendMasterRequest!');
try {
const message: ClusterMessage = {
workerId: data.worker.id,
workerPid: data.worker.process.pid,
workerName: data.worker['name'],
event: data.event,
data: data
};
const sent = data.worker.send(message);
if (!sent) throw new Error(`Failed to send master request to worker ${data.worker.id}`);
} catch (ex) {
WBA.logError(new Error(ex));
}
}
data.worker is a reference of cluster.worker object. Sometimes the send function returns false, but the message is received by the worker.
Normally when sending message I use process.send, but in that case I need to send to that specific worker, so worker.send on that case, process.send return void, worker.send return boolean, why?
|
return proc.send(message, handle); |
I don't think it is returning here, since the message is delivered correctly... so the problem must be the return of proc.send.
if (!proc.connected)
return false;
Here is an example with the worker info:

Node 10.14.0/10.15.3
Windows 10 Pro 64/CentOS 7.6.18.10
Example of code:
data.worker is a reference of cluster.worker object. Sometimes the send function returns false, but the message is received by the worker.
Normally when sending message I use process.send, but in that case I need to send to that specific worker, so worker.send on that case, process.send return void, worker.send return boolean, why?
node/lib/internal/cluster/utils.js
Line 22 in 5f032a7
I don't think it is returning here, since the message is delivered correctly... so the problem must be the return of proc.send.
Here is an example with the worker info:
