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
Failure to recover if network is not available on startup #449
Comments
This is no surprise, but it's easily reproduced just by unplugging the ethernet cable and restarting Homebridge. If the "cacheableLookup ENOTFOUND app.ring.com" error is hit, the plugin never recovers even if you reconnect. This is just more noticeable on reboot because if it happens while you're away or otherwise don't have access, you will lose access to the Ring plugin. |
Every time I do a hb-service restart I get these. [9/16/2020, 3:44:03 PM] [Ring] Failed to reach Ring server at https://app.ring.com/rhq/v1/devices/v1/locations. Cannot read property 'request' of undefined. Trying again in 5 seconds... Then shortly thereafter.. [9/16/2020, 3:44:39 PM] Error: Socket timeout It sometimes does this 2 or 3 times and is then stable. |
I'm not sure what the cause of those errors is, but I don't see the "ENOTFOUND" error code in your logs. I assume there is some kind of domain/address lookup that is failing and caching...despite the network connection recovering. |
One other thing, it seems the oauth requests are able to recover. It initially reports the following: [Ring] Failed to reach Ring server at https://oauth.ring.com/oauth/token. getaddrinfo ENOTFOUND oauth.ring.com. Trying again in 5 seconds... but after reconnecting, it switches to: [Ring] Failed to reach Ring server at https://app.ring.com/rhq/v1/devices/v1/locations. cacheableLookup ENOTFOUND app.ring.com. Trying again in 5 seconds... So it's not clear if this is a bug in cacheable-lookup or how the plugin is implemented. |
Apparently it doesn't even require this to happen at Homebridge startup - if the Mac loses connectivity at any point, the plugin will get stuck in this loop :( |
@ryanleesmith This has been reported before, but I didn't realize I could recreate it just by turning WiFi off and back on, so thanks for the tip! I'm able to recreate this issue on my end now. It has to do with dns caching, which I added months ago. If there is no network connection on startup, it caches an error. I have code in place to clear the base value, but apparently it doesn't work. May be a bug in the library I'm using, but it will take some digging to figure it out. Unfortunately I don't have a ton of free time currently, but will push a fix as soon as I'm able. |
No worries. I'd be more than happy to play around with it if I knew how to reliably install a local version - I've yet to figure out a good way to do this with npm. I cloned your repo locally, ran npx tsc from the main folder, and tried npm -g install from the homebridge folder, but homebridge errors out on startup. |
@ryanleesmith can you give it a try on v |
That resolved it for me. Thanks! |
Bug Report
Describe the Bug
It appears that if Homebridge boots on system start, and the network connection is not immediately available, the Ring plugin will get stuck in a loop where it claims the Ring API endpoints are not reachable. I never had any issues with this setup on a Raspberry Pi, but I recently migrated my setup to a Mac mini for more resources, and it consistently happens every time my Mac starts.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Ring plugin should automatically recover even if network connectivity was not initially available.
Screenshots/Logs
[Ring] Failed to reach Ring server at https://app.ring.com/rhq/v1/devices/v1/locations. cacheableLookup ENOTFOUND app.ring.com. Trying again in 5 seconds...
This log line is printed over and over until rebooting Homebridge.
Additional context
My Mac mini is setup with a wired connection, and automatically logs in without password on boot. All other plugins are able to start and recover from any initial errors. Restarting Homebridge after system boot resolves the issue.
Homebridge Ring Config
Post homebridge-ring platform config without sensitive information
Environment
The text was updated successfully, but these errors were encountered: