edwardchoh/zmqbus-node

createNode() fails in child processes when running as cluster

irixi opened this issue · 0 comments

Hey,

Given that you have a cluster of node processes, the first one will succeed in createNode() but the rest of the child processes will report Error: addMembership EADDRINUSE. I'm on node 0.10.29 and Mac OS X 10.8.5. socket.addMembership() being called multiple times for the same addr:port seems to be the issue?

Unless it's possible to check the state of the multicast for the given addr:port my suggestion would be to wrap the addMembership in try clause (election.js, line 56) and catch any errors. In this particular case everything is working normally - afaik - because the addMembership succeeded for the parent process. I'm sure there's a better way :)

Cheers,

K