-
Notifications
You must be signed in to change notification settings - Fork 30.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cluster: worker.send returning false, but message is sent #26937
Comments
They both return booleans. I'm not sure where you got the idea that I'm going to close this out because I see nothing that suggests a bug in Node.js. If you have follow-up questions, please post them to the nodejs/help repo. |
This should be documented, maybe boolean is not the best type to return process.send values... If the message is not queued and not sent, what is the return value?
The problem is the node types package @types/node, there the process.send interface returns void instead of boolean... |
https://nodejs.org/api/child_process.html#child_process_subprocess_send_message_sendhandle_options_callback describes the meaning of the boolean return. It should be described in https://nodejs.org/api/cluster.html#cluster_worker_send_message_sendhandle_callback and As for @types/node, node.js doesn't maintain that, you should report the bug in the type def to the maintainer. |
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:

The text was updated successfully, but these errors were encountered: