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

Error: addMembership ENODEV #38

Open
thom-nic opened this issue Aug 11, 2017 · 6 comments
Open

Error: addMembership ENODEV #38

thom-nic opened this issue Aug 11, 2017 · 6 comments

Comments

@thom-nic
Copy link

This actually crashes my node process by way of an unhandled error event. Because it's an event, it's not immediately apparent where it's thrown, probably has to do with multicast registration.

Aug 11 14:20:41 myhost node[1382]: events.js:160
Aug 11 14:20:41 myhost node[1382]:       throw er; // Unhandled 'error' event
Aug 11 14:20:41 myhost node[1382]:       ^
Aug 11 14:20:41 myhost node[1370]: Error: addMembership ENODEV

I encountered it in my own project which uses bonjour but it looks like it has turned up in webpack as well: webpack/webpack-dev-server#979. Unfortunately they "fixed" it by simply not using bonjour 😂

@thom-nic
Copy link
Author

Came across jmdns/jmdns#84 which gives some hints as to the cause.
It's probably originating here: https://github.com/mafintosh/multicast-dns/blob/master/index.js#L53-L55

Although I'm not clear as to why the OS is emitting the ENODEV error.

@thom-nic
Copy link
Author

thom-nic commented Aug 11, 2017

As a stopgap, I think I can add the following to prevent the error event from crashing node:

b = bonjour();
b._server.mdns.on('error',err => console.error('mdns server', err));

EDIT: actually I don't think that will work as it looks like the socket gets bound as soon as the multicastdns instance is created... So it's a bit of a race whether the listener will be added before the socket.on('listening' callback gets fired where that error is being emitted.

This is starting to feel more like an issue in multicast-dns so I may move the issue report there.

@AMontagu
Copy link

I have the same error only when bonjour start when my computer is not connected to a router.
Prevented by checked if there is a connection to a router before requiring bonjour.

If this is possible to have correct handler or a correct way to prevent this error and you find it please tell me :).

@thom-nic
Copy link
Author

Prevented by checked if there is a connection to a router before requiring bonjour.

Can you provide a code snippet? Do you enumerate os.networkInterfaces() and look for one with a gateway?

@AMontagu
Copy link

Hello ! No I am on a multi process architecture with already a python process that manage all the connection task. I just ask it to give me the current connection state.

Sorry I am not able to give you some code snippet in node.

@thom-nic
Copy link
Author

No problem. But this follows what I saw - it happened when I had a link-local address and no gateway. The problem is, Bonjour is designed to work in link-local environments without DNS/DHCP! :(

The core of the issue is clearly OS-level behavior, but I wish I could understand exactly why/ under what conditions exactly so I can best determine how to work around the issue.

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

2 participants