-
Notifications
You must be signed in to change notification settings - Fork 30.1k
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
UDP multicast in the cluster does not work #12572
Comments
It makes sense to me, since IIRC there is only one udp socket in the master process and the first fork already added membership for that socket. |
UDP is a bit special with cluster: the socket is created in the master process and each worker gets a copy (as in The copies still refer to the same socket though, so you get the same effect as when you call dgram.createSocket('udp4').bind(12345, function() {
this.addMembership('239.0.0.1'); // ok
this.addMembership('239.0.0.1'); // EADDRINUSE
}); As a workaround, set up your script so that only one worker calls The cluster module could track simple cases like your test case but it gets complex fast when different workers join or leave different multicast groups, with plenty potential for unexpected interactions. My gut reaction is that it is better to document the workaround than trying to fix it up and get trapped in a tar pit of edge cases. |
I've tried to connect to UDP multicast from nodejs cluster.
It failed on the second process.
We are getting this error:
Code we used:
The text was updated successfully, but these errors were encountered: