Skip to content
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

Using Discover inside cluster causes unhandled exception on windows #18

Closed
cwi-vvatsos opened this issue Nov 8, 2015 · 7 comments
Closed

Comments

@cwi-vvatsos
Copy link

According to NodeJS archives , sharing a UDP port on windows causes an ENOTSUP unhandled exception.
This ofcourse happens with Discover.

The solution offered is to mark UDP ports as exclusive. This does not solve the issue for someone wanting to have multiple cluster childs in the some discovery cluster, but it does for those using different childs for different Discovery clusters on different ports.

I managed to fix this on my development by changing
self.socket.bind(self.port, self.address, function () {
to
self.socket.bind({port:self.port, address:self.address,exclusive:true}, function () {
on Network.prototype.start in network.js

I think this can be also changed to
self.socket.bind({port:self.port, address:self.address,exclusive:!self.reuseAddr}, function () {
so that no extra option is created for this issue.

If some other solution exists for Windows, please forgive my ignorance. I am quite the beginner in nodejs-cluster development

@Goran-n
Copy link

Goran-n commented Mar 6, 2020

@wankdanker Why is this not a part of the master

wankdanker added a commit that referenced this issue Mar 6, 2020
@wankdanker
Copy link
Owner

@Goran-n There was no pull request. Not, that I'm good at merging those in a timely mannger.

Anyway, I just modified master if you want to try it out.

@Goran-n
Copy link

Goran-n commented Mar 6, 2020

@wankdanker I created this fix in a fork.. Also, sorry for my premature comment, after doing some testing the above code suggested actually conflcits with other reuseAddr uses within network.js.

What i did was add a new variable called "exclusive". I've created a pull request if you want to merge it. If you think both can coexist then probably dont merge the pr. https://github.com/wankdanker/node-discover/pull/42

@wankdanker
Copy link
Owner

@Goran-n I like the granular approach. I think having it as a separate option is good and avoids conflicting with reuseAddr. I'll merge that. Thanks!

@wankdanker
Copy link
Owner

node-discover@1.1.3 is on npm. Can you confirm that this fixes this bug on Windows?

@Goran-n
Copy link

Goran-n commented Mar 6, 2020

@wankdanker working on my end. I think you can close this. Thanks

@wankdanker
Copy link
Owner

@Goran-n Awesome. Thanks for helping to push this along.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants