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

gateway fails to start if there is no internet connection #1401

Closed
dhylands opened this issue Oct 11, 2018 · 4 comments
Closed

gateway fails to start if there is no internet connection #1401

dhylands opened this issue Oct 11, 2018 · 4 comments
Assignees
Milestone

Comments

@dhylands
Copy link
Contributor

When I was in Hong Kong, I tried starting the gateway standalone, i.e. not connected to the internet.

It failed to start with the following error:

Opening database: /home/dhylands/moziot/.mozilla-iot/config/db.sqlite3
2018-10-02 19:16:32.947 HTTP server listening on port 8080
2018-10-02 19:16:32.988 Not checking SHA256SUMS file for zigbee-adapter since a .git directory was detected
2018-10-02 19:16:33.054 DNS config is: dave-work
2018-10-02 19:16:33.055 Service Discovery: changing profile - local domain is now: dave-work
2018-10-02 19:16:33.136 Service Discovery: state changed to: true
Error: send ENETUNREACH 224.0.0.251:5353
    at Object._errnoException (util.js:1022:11)
    at _exceptionWithHostPort (util.js:1044:20)
    at SendWrap.afterSend [as oncomplete] (dgram.js:499:11)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! things-gateway@0.6.0 start: `webpack && node build/gateway.js "-d"`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the things-gateway@0.6.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
@hobinjk
Copy link
Contributor

hobinjk commented Oct 11, 2018

From the IP address 224.0.0.251 this appears to be an issue with mDNS/dnssd

@dhylands
Copy link
Contributor Author

That's the multicast IP address. I ran into this problem when trying to run the gateway on my laptop with no Wifi connection or ethernet connection, so there were no adapters present which supported multicast.

I think we just need to add a try/catch someplace and not make it crash.

I wasn;t able to run the gateway until I setup a hotspot on my phone and connected to that.

@jaller94
Copy link

jaller94 commented Oct 12, 2018

I assume that this is the code location.

https://github.com/mozilla-iot/gateway/blob/cddc76b01448620fa36e83aa5f202a90c36e1ad1/src/mdns-server.js#L73

I am interested to take this as a first issue to submit a PR to.

Are there acceptance criteria of how frequently the gateway should retry to advertise the service via dnssd? (e.g. every 10 seconds or every minute or only when the network state changes)

Minimal code to reproduce

Ensure that you are not connected to any network.

const dnssd = require('dnssd');
const ad = new dnssd.Advertisement(dnssd.tcp('http'), 4321);
console.log('starting...');
ad.start();  // must be async, "started" still gets printed
console.log('started');

@jaller94
Copy link

The project webthing-node has the same issue.
WebThingsIO/webthing-node#70

@mrstegeman mrstegeman self-assigned this Oct 12, 2018
mrstegeman added a commit to mrstegeman/gateway that referenced this issue Oct 12, 2018
@ghost ghost added review and removed in progress labels Oct 12, 2018
mrstegeman added a commit to mrstegeman/gateway that referenced this issue Oct 12, 2018
mrstegeman added a commit to mrstegeman/gateway that referenced this issue Oct 12, 2018
mrstegeman added a commit that referenced this issue Oct 12, 2018
@ghost ghost removed the review label Oct 12, 2018
mrstegeman added a commit to mrstegeman/gateway that referenced this issue Oct 23, 2018
mrstegeman added a commit that referenced this issue Oct 24, 2018
@mrstegeman mrstegeman added this to the 0.6.1 milestone Jan 9, 2019
@mrstegeman mrstegeman added this to Done in WebThings Gateway Apr 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

No branches or pull requests

4 participants