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

Plugins tab does not load without internet access #598

Closed
Zer0x00 opened this issue Apr 2, 2020 · 3 comments
Closed

Plugins tab does not load without internet access #598

Zer0x00 opened this issue Apr 2, 2020 · 3 comments
Labels

Comments

@Zer0x00
Copy link
Contributor

Zer0x00 commented Apr 2, 2020

Describe The Bug:

If you have no internet connection the plugins tab will just load forever and show no plugins.

To Reproduce:

Block the outgoing / incoming internet traffic to your homebridge-config-ui-x device and go to http://192.168.0.100:8080/plugins

http://192.168.0.100:8080/api/plugins seems does not respond.

Expected behavior:

You should be able to delete and configure the installed plugins without any internet access.

Logs:

Apr 01 23:26:10 RasPi systemd[1]: Started Homebridge Config UI X.
Apr 01 23:26:15 RasPi homebridge-config-ui-x[4182]: [4/1/2020, 11:26:15 PM] [Config] Homebridge Config UI X v4.13.3 is listening on 0.0.0.0 port 8080
Apr 01 23:26:38 RasPi homebridge-config-ui-x[4182]: [4/1/2020, 11:26:38 PM] [Config] Failed to check for Node.js version updates
Apr 01 23:26:55 RasPi homebridge-config-ui-x[4182]: [4/1/2020, 11:26:55 PM] [Config] [npm] Failed to check registry.npmjs.org for updates: getaddrinfo EAI_AGAIN registry.npmjs.org registry.npmjs.org:443
Apr 01 23:26:58 RasPi homebridge-config-ui-x[4182]: [4/1/2020, 11:26:58 PM] [Config] [homebridge] Failed to check registry.npmjs.org for updates: getaddrinfo EAI_AGAIN registry.npmjs.org registry.npmjs.org:443
Apr 01 23:27:15 RasPi homebridge-config-ui-x[4182]: [4/1/2020, 11:27:15 PM] [Config] Failed to check for Node.js version updates
Apr 01 23:27:18 RasPi homebridge-config-ui-x[4182]: [4/1/2020, 11:27:18 PM] [Config] [npm] Failed to check registry.npmjs.org for updates: getaddrinfo EAI_AGAIN registry.npmjs.org registry.npmjs.org:443
Apr 01 23:27:35 RasPi homebridge-config-ui-x[4182]: [4/1/2020, 11:27:35 PM] [Config] [homebridge] Failed to check registry.npmjs.org for updates: getaddrinfo EAI_AGAIN registry.npmjs.org registry.npmjs.org:443
Apr 01 23:27:38 RasPi homebridge-config-ui-x[4182]: [4/1/2020, 11:27:38 PM] [Config] [homebridge-alexa] Failed to check registry.npmjs.org for updates: getaddrinfo EAI_AGAIN registry.npmjs.org registry.npmjs.org:443


--> Changed here from page "Status" to "Plugins"


Apr 01 23:27:55 RasPi homebridge-config-ui-x[4182]: [4/1/2020, 11:27:55 PM] [Config] [homebridge-blinds] Failed to check registry.npmjs.org for updates: getaddrinfo EAI_AGAIN registry.npmjs.org registry.npmjs.org:443
Apr 01 23:27:58 RasPi homebridge-config-ui-x[4182]: [4/1/2020, 11:27:58 PM] [Config] [homebridge-config-ui-x] Failed to check registry.npmjs.org for updates: getaddrinfo EAI_AGAIN registry.npmjs.org registry.npmjs.org:443
Apr 01 23:28:15 RasPi homebridge-config-ui-x[4182]: [4/1/2020, 11:28:15 PM] [Config] [homebridge-...] Failed to check registry.npmjs.org for updates: getaddrinfo EAI_AGAIN registry.npmjs.org registry.npmjs.org:443
[some more of these lines with other plugins]
Apr 01 23:29:15 RasPi homebridge-config-ui-x[4182]: [4/1/2020, 11:29:15 PM] [Config] [homebridge-alexa] Failed to check registry.npmjs.org for updates: getaddrinfo EAI_AGAIN registry.npmjs.org registry.npmjs.org:443
Apr 01 23:29:18 RasPi homebridge-config-ui-x[4182]: [4/1/2020, 11:29:18 PM] [Config] [homebridge-blinds] Failed to check registry.npmjs.org for updates: getaddrinfo EAI_AGAIN registry.npmjs.org registry.npmjs.org:443
Apr 01 23:29:35 RasPi homebridge-config-ui-x[4182]: [4/1/2020, 11:29:35 PM] [Config] [homebridge-config-ui-x] Failed to check registry.npmjs.org for updates: getaddrinfo EAI_AGAIN registry.npmjs.org registry.npmjs.org:443
[...]

Screenshots:

image
image

Environment:

  • Node.js Version: 10.19.0
  • NPM Version: 6.14.3
  • Homebridge Version: 0.4.53
  • Homebridge Config UI X Version: 4.13.3
  • Operating System: Debian (DietPi)
  • Process Supervisor: Systemd
@Zer0x00 Zer0x00 added the bug label Apr 2, 2020
@oznu
Copy link
Member

oznu commented Apr 2, 2020

Those are series of DNS lookup timeouts.

I'll check this out - the page does load if you're completely offline - i.e. don't have your server configured with DNS servers it can't connect to.

@Zer0x00
Copy link
Contributor Author

Zer0x00 commented Apr 2, 2020

[...] i.e. don't have your server configured with DNS servers it can't connect to.

My ISP is down right now, so this was the test case for me (:

@oznu
Copy link
Member

oznu commented Apr 2, 2020

@buenyamin-olgun, if your ISP is still down but you're somehow able to download updates, I've pushed a bugfix for this to @test.

https://github.com/oznu/homebridge-config-ui-x/wiki/How-To-Test-Upcoming-Changes

While the "request" timeout was set to 5 seconds, the dns lookup portion of this did not count towards the 5 seconds. Adding to the problem is the fact that dns lookups a synchronous, which means if you had more than a couple plugins the page would never load like what you have experienced.

The dns lookups are also handled by the OS and unfortunately Node.js provides no way to set a dns lookup timeout dynamically.

To fix this I set a hard cap of 15 seconds on the request. All the plugins are checked for updates asynchronously already, so there will only be a single ~15 second delay.

After the 15 seconds you will see a message like this in the log, but the plugins will load.

Failed to check registry.npmjs.org for updates: Timeout: request took more than 15 seconds

I've set it to 15 seconds for now as I want to make sure I don't break anything for users running really slow machines (like the Raspberry Pi Zero). I'll drop this down further if no one raises any issues.

@oznu oznu closed this as completed in eef4bb2 Apr 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants