superhawk610 / multicast

:green_heart: A persistent solution to presenting content across multiple Chromecast devices.
https://superhawk610.github.io/multicast-site/
MIT License
219 stars 28 forks source link

Error: getaddrinfo -3008 #23

Closed teknetik closed 6 years ago

teknetik commented 7 years ago

After patching the resolver_sequence_tasks.js issue highlighted on the main page I now get the following error:

MultiCast is live!
listening at port 3944...
events.js:182
      throw er; // Unhandled 'error' event
      ^

Error: getaddrinfo -3008
    at errnoException (/root/.nvm/versions/node/v8.7.0/lib/node_modules/multicast/node_modules/mdns/lib/resolver_sequence_tasks.js:199:11)
    at getaddrinfo_complete (/root/.nvm/versions/node/v8.7.0/lib/node_modules/multicast/node_modules/mdns/lib/resolver_sequence_tasks.js:112:10)
    at GetAddrInfoReqWrap.oncomplete (/root/.nvm/versions/node/v8.7.0/lib/node_modules/multicast/node_modules/mdns/lib/resolver_sequence_tasks.js:120:9)

Any insights to this would be welcomed as I am new to using node and I am quite excited about this project, thanks.

superhawk610 commented 7 years ago

Can you run the three following commands and reply with the output?

node -v
uname -a
sudo cat /root/.nvm/versions/node/v8.7.0/lib/node_modules/multicast/node_modules/mdns/lib/resolver_sequence_tasks.js

How is your device connected to your receivers? Wireless or wired? Are they on the same local network? Have you registered your device(s) and application ID through the Cast SDK console?

teknetik commented 7 years ago

Thanks for the reply below is the requested output

node -v v8.7.0

# uname -a Linux sabz 3.10.0-514.26.2.el7.x86_64 #1 SMP Tue Jul 4 15:04:05 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

Below is the function I think you're looking for but I attached the full file all the same:

function getaddrinfo_0_11(host, family, cb) { var req = new cares.GetAddrInfoReqWrap() , err = cares.getaddrinfo(req, host, family, 0, false) ; req.oncomplete = function oncomplete(err, addresses) { getaddrinfo_complete(err, addresses, cb); } if (err) throw errnoException(err, 'getaddrinfo', host); } [resolver_sequence_tasks.js.zip](https://github.com/superhawk610/multicast/files/1393896/resolver_sequence_tasks.js.zip)

Multicast is running on a CentOS Linux release 7.3.1611 (Core) server Hardwired to the router. Chromecast device is registered with Cast SDK.

Avahi sees the Chromecast device:

= enp3s0 IPv4 Chromecast-6fb514f60c12884cf88433ba81f0b25a _googlecast._tcp local hostname = [6fb514f6-0c12-884c-f884-33ba81f0b25a.local] address = [192.168.1.122] port = [8009] txt = ["rs=" "nf=1" "bs=FA8FCA8AE27F" "st=0" "ca=4101" "fn=Desk" "ic=/setup/icon.png" "md=Chromecast" "ve=05" "rm=21CACF6F71C2F277" "cd=56F306DF5A1D25B1CC6AD04612B8F63C" "id=6fb514f60c12884cf88433ba81f0b25a"]

Brekmister commented 7 years ago

I actually had multiple really random issues deploying to CentOS that only reproduces on that one server and nothing else. Couldn't seem to diagnose it.

Also, have you patched node-mdns for Node.js 8.60 and above? That may cause an issue.

On Oct 18, 2017 3:32 AM, "Carl Draper" notifications@github.com wrote:

Thanks for the reply below is the requested output

node -v v8.7.0

uname -a Linux sabz 3.10.0-514.26.2.el7.x86_64 #1 SMP Tue Jul 4 15:04:05

UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

Below is the function I think you're looking for but I attached the full file all the same:

function getaddrinfo_0_11(host, family, cb) { var req = new cares.GetAddrInfoReqWrap() , err = cares.getaddrinfo(req, host, family, 0, false) ; req.oncomplete = function oncomplete(err, addresses) { getaddrinfo_complete(err, addresses, cb); } if (err) throw errnoException(err, 'getaddrinfo', host); } resolver_sequence_tasks.js. zip

Multicast is running on a CentOS Linux release 7.3.1611 (Core) server Hardwired to the router. Chromecast device is registered with Cast SDK.

Avahi sees the Chromecast device:

= enp3s0 IPv4 Chromecast-6fb514f60c12884cf88433ba81f0b25a _googlecast._tcp local hostname = [6fb514f6-0c12-884c-f884-33ba81f0b25a.local] address = [192.168.1.122] port = [8009] txt = ["rs=" "nf=1" "bs=FA8FCA8AE27F" "st=0" "ca=4101" "fn=Desk" "ic=/setup/icon.png" "md=Chromecast" "ve=05" "rm=21CACF6F71C2F277" "cd= 56F306DF5A1D25B1CC6AD04612B8F63C" "id=6fb514f60c12884cf88433ba81f0b25a"]

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/superhawk610/multicast/issues/23#issuecomment-337503462, or mute the thread https://github.com/notifications/unsubscribe-auth/AIAC9oVZzqvgkAW3bEr2weA4GjRDR8oOks5stbePgaJpZM4P8-Cc .

superhawk610 commented 7 years ago

@Brekmister the third thing he posted was to double check that he'd patched the node_mdns issue (which it looks like he has). I haven't tried running on Node 8.7 yet, and my dev machine is on Ubuntu so it's possible that this is a CentOS bug or a Node 8.7 bug.

Did you get the wall of warning messages from Avahi before it displayed Multicast is live!?

What's the name of the Avahi/mDNS package on CentOS?

EDIT: On Ubuntu it's called libavahi-compat-libdnssd-dev.

superhawk610 commented 7 years ago

@teknetik looks like this is a known issue with node_mdns when resolving IPv4/IPv6 addresses.

In app/main.js, try making the following change at line 38:

  /* Only scan IPv4 addresses */
  mdns.Browser.defaultResolverSequence[1] = 'DNSServiceGetAddrInfo' in mdns.dns_sd ?
-   mdns.rst.DNSServiceGetAddrInfo() : mdns.rst.getaddrinfo({ families: [4] })
+   mdns.rst.DNSServiceGetAddrInfo() : mdns.rst.getaddrinfo({ families: [0] })

This should allow both IPv4 and IPv6 address resolution.

If this doesn't work, that thread I linked mention some sort of edits you can make to /etc/nsswitch.conf..

teknetik commented 7 years ago

Thanks for the ideas guys. I edited:

`/root/.nvm/versions/node/v8.7.0/lib/node_modules/multicast/app/main.js

/ Only scan IPv4 addresses / mdns.Browser.defaultResolverSequence[1] = 'DNSServiceGetAddrInfo' in mdns.dns_sd ? mdns.rst.DNSServiceGetAddrInfo() : mdns.rst.getaddrinfo({ families: [0] })`

Still no look. If we I will keep digging around see if I can find a solution.

andrewpryor commented 6 years ago

Should "nss-mdns" be included in the prerequisites?

sudo yum install gcc gcc-c++ avahi avahi-compat-libdns_sd avahi-compat-libdns_sd-devel nss-mdns 

It seems to have resolved my issue without any code changes/patches.

superhawk610 commented 6 years ago

@teknetik can you confirm that installing nss-mdns resolves your issue?

@andrewpryor how did you come across that package? Is it an official requirement of node_mdns on distributions that use yum?

andrewpryor commented 6 years ago

Installing "nss_mdns" does resolve my "Error: getaddrinfo -3008" issue on CentOS 7.4.1708. I began with a minimal install of CentOS so I don't know if the package is included in other installation types.

I can access the dashboard on port 3944, setup Channels and Devices, issue Alerts and Takeovers, etc. It appears to be fully functional.

Total nodejs noob here, but curiosity led me to read agnat's comments fromthe known issue link you shared in the post on Oct 18th. Thinking host resolution seems to be the primary issue I started with ...

sudo yum search mdns
... stuff ...
nss-mdns.x86_64 : glibc plugin for .local name resolution

sudo yum info nss-mdns
... stuff ...
Available Packages
Name        : nss-mdns
Arch        : x86_64
Version     : 0.10
Release     : 12.el7
Size        : 29 k
Repo        : epel/x86_64
Summary     : glibc plugin for .local name resolution
URL         : http://0pointer.de/lennart/projects/nss-mdns/
License     : LGPLv2+
Description : nss-mdns is a plugin for the GNU Name Service Switch (NSS) functionality of
            : the GNU C Library (glibc) providing host name resolution via Multicast DNS
            : (aka Zeroconf, aka Apple Rendezvous, aka Apple Bonjour), effectively allowing
            : name resolution by common Unix/Linux programs in the ad-hoc mDNS domain .local.
            :
            : nss-mdns provides client functionality only, which means that you have to
            : run a mDNS responder daemon separately from nss-mdns if you want to register
            : the local host name via mDNS (e.g. Avahi).

... which sounds like a necessary component.

superhawk610 commented 6 years ago

Excellent find. When I get a chance this evening I'll spin up a virtual box and see if I can replicate this behavior.

superhawk610 commented 6 years ago

@andrewpryor I can confirm that nss_mdns was the missing piece of the puzzle! I have this successfully working on a CentOS 7.3 box. I'll push an update to the readme and give you credit. Thanks!

superhawk610 commented 6 years ago

Closed in f3ac1bcd5106977b428eb74c57630bacf92a8657.