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

failing to reach ring server #1506

Open
1 task done
pcziesch opened this issue Oct 11, 2024 · 69 comments
Open
1 task done

failing to reach ring server #1506

pcziesch opened this issue Oct 11, 2024 · 69 comments
Labels
bug Something isn't working

Comments

@pcziesch
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Describe The Bug

sinces some days i recognized that my cams and all other devices from ring not shown in my apple home which wasn't an issue at all in the past. the homebridge runs on an qnap NAS via docker which didn't change since years also. i do not have any clue why this happens no and rebooting of NAS , homebrodge, Router etc doesn't fix anything

To Reproduce

No response

Expected behavior

plugin should connect to ring api server

Relevant log output

[10/11/2024, 6:41:31 AM] [HB Supervisor] Restarting Homebridge...
[10/11/2024, 6:41:31 AM] [HB Supervisor] Starting Homebridge with extra flags: -I -P /var/lib/homebridge/node_modules --strict-plugin-resolution
[10/11/2024, 6:41:31 AM] [HB Supervisor] Started Homebridge v1.8.4 with PID: 1376
[10/11/2024, 6:41:32 AM] Homebridge requires Node.js version of ^18.15.0 || ^20.7.0 which does not satisfy the current Node.js version of v18.13.0. You may need to upgrade your installation of Node.js - see https://homebridge.io/w/JTKEF
[10/11/2024, 6:41:32 AM] Loaded config.json with 0 accessories and 2 platforms.
[10/11/2024, 6:41:32 AM] Loaded 0 cached accessories from cachedAccessories.
[10/11/2024, 6:41:32 AM] ---
[10/11/2024, 6:41:33 AM] Loaded plugin: [email protected]
[10/11/2024, 6:41:33 AM] Registering platform 'homebridge-ring.Ring'
[10/11/2024, 6:41:33 AM] ---
[10/11/2024, 6:41:33 AM] Loading 2 platforms...
[10/11/2024, 6:41:33 AM] [Ring] Initializing Ring platform...
Setup Payload:
X-HM://number
Enter this code with your HomeKit app on your iOS device to pair with Homebridge:
                       
    ┌────────────┐     
    │ 116-32-834 │     
    └────────────┘     
                       
[10/11/2024, 6:41:33 AM] Homebridge v1.8.4 (HAP v0.12.2) (Homebridge FCB1) is running on port 51224.
[10/11/2024, 6:41:33 AM] 

NOTICE TO USERS AND PLUGIN DEVELOPERS
> Homebridge 2.0 is on the way and brings some breaking changes to existing plugins.
> Please visit the following link to learn more about the changes and how to prepare:
> https://github.com/homebridge/homebridge/wiki/Updating-To-Homebridge-v2.0

[10/11/2024, 6:41:42 AM] [Homebridge UI] [homebridge-config-ui-x] Failed to check registry.npmjs.org for updates: "timeout of 10000ms exceeded" - see https://homebridge.io/w/JJSz6 for help.
[10/11/2024, 6:41:55 AM] [Ring] Found the following locations:
[10/11/2024, 6:41:55 AM] [Ring]   locationId: xxx - xxx
[10/11/2024, 6:41:55 AM] [Ring] Creating location socket.io connection - xxx
[10/11/2024, 6:42:05 AM] [Ring] Failed to reach Ring server at https://api.ring.com/clients_api/doorbots/number/subscribe.  fetch failed.  Trying again in 5 seconds...
[10/11/2024, 6:42:05 AM] [Ring] Failed to reach Ring server at https://api.ring.com/clients_api/doorbots/number/motions_subscribe.  fetch failed.  Trying again in 5 seconds...
[10/11/2024, 6:42:05 AM] [Ring] Failed to reach Ring server at https://api.ring.com/clients_api/doorbots/number/subscribe.  fetch failed.  Trying again in 5 seconds...
[10/11/2024, 6:42:05 AM] [Ring] Failed to reach Ring server at https://api.ring.com/clients_api/doorbots/number/motions_subscribe.  fetch failed.  Trying again in 5 seconds...
[10/11/2024, 6:42:05 AM] [Ring] Failed to reach Ring server at https://prd-api-us.prd.rings.solutions/api/v1/clap/tickets?locationID=number-number.  fetch failed.  Trying again in 5 seconds...
[10/11/2024, 6:42:20 AM] [Ring] Failed to reach Ring server at https://api.ring.com/clients_api/doorbots/number/subscribe.  fetch failed.  Trying again in 5 seconds...
[10/11/2024, 6:42:20 AM] [Ring] Failed to reach Ring server at https://api.ring.com/clients_api/doorbots/number/motions_subscribe.  fetch failed.  Trying again in 5 seconds...
[10/11/2024, 6:42:20 AM] [Ring] Failed to reach Ring server at https://api.ring.com/clients_api/doorbots/number/subscribe.  fetch failed.  Trying again in 5 seconds...
[10/11/2024, 6:42:20 AM] [Ring] Failed to reach Ring server at https://api.ring.com/clients_api/doorbots/number/motions_subscribe.  fetch failed.  Trying again in 5 seconds...
[10/11/2024, 6:42:20 AM] [Ring] Failed to reach Ring server at https://prd-api-us.prd.rings.solutions/api/v1/clap/tickets?locationID=number-number.  fetch failed.  Trying again in 5 seconds...
[10/11/2024, 6:42:25 AM] [Ring] Failed to reach Ring server at https://api.ring.com/clients_api/ring_devices.  fetch failed.  Trying again in 5 seconds...
[10/11/2024, 6:42:35 AM] [Ring] Failed to reach Ring server at https://api.ring.com/clients_api/doorbots/number/subscribe.  fetch failed.  Trying again in 5 seconds...
[10/11/2024, 6:42:35 AM] [Ring] Failed to reach Ring server at https://api.ring.com/clients_api/doorbots/number/motions_subscribe.  fetch failed.  Trying again in 5 seconds...
[10/11/2024, 6:42:35 AM] [Ring] Failed to reach Ring server at https://api.ring.com/clients_api/doorbots/number/subscribe.  fetch failed.  Trying again in 5 seconds...
[10/11/2024, 6:42:35 AM] [Ring] Failed to reach Ring server at https://api.ring.com/clients_api/doorbots/number/motions_subscribe.  fetch failed.  Trying again in 5 seconds...
[10/11/2024, 6:42:35 AM] [Ring] Failed to reach Ring server at https://prd-api-us.prd.rings.solutions/api/v1/clap/tickets?locationID=number-number.  fetch failed.  Trying again in 5 seconds...
[10/11/2024, 6:42:40 AM] [Ring] Failed to reach Ring server at https://api.ring.com/clients_api/ring_devices.  fetch failed.  Trying again in 5 seconds...
[10/11/2024, 6:42:50 AM] [Ring] Failed to reach Ring server at https://api.ring.com/clients_api/doorbots/number/subscribe.  fetch failed.  Trying again in 5 seconds...
[10/11/2024, 6:42:50 AM] [Ring] Failed to reach Ring server at https://api.ring.com/clients_api/doorbots/number/motions_subscribe.  fetch failed.  Trying again in 5 seconds...
[10/11/2024, 6:42:50 AM] [Ring] Failed to reach Ring server at https://api.ring.com/clients_api/doorbots/number/subscribe.  fetch failed.  Trying again in 5 seconds...
[10/11/2024, 6:42:50 AM] [Ring] Failed to reach Ring server at https://api.ring.com/clients_api/doorbots/number/motions_subscribe.  fetch failed.  Trying again in 5 seconds...
[10/11/2024, 6:42:50 AM] [Ring] Failed to reach Ring server at https://prd-api-us.prd.rings.solutions/api/v1/clap/tickets?locationID=number-number.  fetch failed.  Trying again in 5 seconds...
[10/11/2024, 6:42:50 AM] [Ring] Failed to connect push notification receiver
[10/11/2024, 6:42:50 AM] [Ring] TypeError: fetch failed
    at Object.fetch (node:internal/deps/undici/undici:14062:11)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at retry (/homebridge/node_modules/homebridge-ring/node_modules/@eneris/push-receiver/src/utils/request.ts:17:16)
    at checkIn (/homebridge/node_modules/homebridge-ring/node_modules/@eneris/push-receiver/src/gcm.ts:24:25)
    at exports.default (/homebridge/node_modules/homebridge-ring/node_modules/@eneris/push-receiver/src/gcm.ts:18:21)
    at PushReceiver.registerIfNeeded (/homebridge/node_modules/homebridge-ring/node_modules/@eneris/push-receiver/src/client.ts:165:21)
    at PushReceiver.connect (/homebridge/node_modules/homebridge-ring/node_modules/@eneris/push-receiver/src/client.ts:93:9)
    at RingApi.registerPushReceiver (/homebridge/node_modules/homebridge-ring/node_modules/ring-client-api/lib/api.js:177:13) {
  cause: ConnectTimeoutError: Connect Timeout Error
      at onConnectTimeout (node:internal/deps/undici/undici:7897:28)
      at node:internal/deps/undici/undici:7855:50
      at Immediate._onImmediate (node:internal/deps/undici/undici:7886:13)
      at processImmediate (node:internal/timers:471:21) {
    code: 'UND_ERR_CONNECT_TIMEOUT'
  }
}
[10/11/2024, 6:42:55 AM] [Ring] Failed to reach Ring server at https://api.ring.com/clients_api/ring_devices.  fetch failed.  Trying again in 5 seconds...
[10/11/2024, 6:43:05 AM] [Ring] Failed to reach Ring server at https://api.ring.com/clients_api/doorbots/number/subscribe.  fetch failed.  Trying again in 5 seconds...
[10/11/2024, 6:43:05 AM] [Ring] Failed to reach Ring server at https://api.ring.com/clients_api/doorbots/number/motions_subscribe.  fetch failed.  Trying again in 5 seconds...
[10/11/2024, 6:43:05 AM] [Ring] Failed to reach Ring server at https://api.ring.com/clients_api/doorbots/number/subscribe.  fetch failed.  Trying again in 5 seconds...
[10/11/2024, 6:43:05 AM] [Ring] Failed to reach Ring server at https://api.ring.com/clients_api/doorbots/number/motions_subscribe.  fetch failed.  Trying again in 5 seconds...
[10/11/2024, 6:43:05 AM] [Ring] Failed to reach Ring server at https://prd-api-us.prd.rings.solutions/api/v1/clap/tickets?locationID=number-number.  fetch failed.  Trying again in 5 seconds...
[10/11/2024, 6:43:10 AM] [Ring] Failed to reach Ring server at https://api.ring.com/clients_api/ring_devices.  fetch failed.  Trying again in 5 seconds...
[10/11/2024, 6:43:20 AM] [Ring] Failed to reach Ring server at https://api.ring.com/clients_api/doorbots/number/subscribe.  fetch failed.  Trying again in 5 seconds...
[10/11/2024, 6:43:20 AM] [Ring] Failed to reach Ring server at https://api.ring.com/clients_api/doorbots/number/motions_subscribe.  fetch failed.  Trying again in 5 seconds...
[10/11/2024, 6:43:20 AM] [Ring] Failed to reach Ring server at https://api.ring.com/clients_api/doorbots/number/subscribe.  fetch failed.  Trying again in 5 seconds...
[10/11/2024, 6:43:20 AM] [Ring] Failed to reach Ring server at https://api.ring.com/clients_api/doorbots/number/motions_subscribe.  fetch failed.  Trying again in 5 seconds...
[10/11/2024, 6:43:20 AM] [Ring] Failed to reach Ring server at https://prd-api-us.prd.rings.solutions/api/v1/clap/tickets?locationID=number-number.  fetch failed.  Trying again in 5 seconds...
[10/11/2024, 6:43:25 AM] [Ring] Failed to reach Ring server at https://api.ring.com/clients_api/ring_devices.  fetch failed.  Trying again in 5 seconds...
[10/11/2024, 6:43:35 AM] [Ring] Failed to reach Ring server at https://api.ring.com/clients_api/doorbots/number/subscribe.  fetch failed.  Trying again in 5 seconds...
[10/11/2024, 6:43:35 AM] [Ring] Failed to reach Ring server at https://api.ring.com/clients_api/doorbots/number/motions_subscribe.  fetch failed.  Trying again in 5 seconds...
[10/11/2024, 6:43:35 AM] [Ring] Failed to reach Ring server at https://api.ring.com/clients_api/doorbots/number/subscribe.  fetch failed.  Trying again in 5 seconds...
[10/11/2024, 6:43:35 AM] [Ring] Failed to reach Ring server at https://api.ring.com/clients_api/doorbots/number/motions_subscribe.  fetch failed.  Trying again in 5 seconds...
[10/11/2024, 6:43:35 AM] [Ring] Failed to reach Ring server at https://prd-api-us.prd.rings.solutions/api/v1/clap/tickets?locationID=number-number.  fetch failed.  Trying again in 5 seconds...
[10/11/2024, 6:43:40 AM] [Ring] Failed to reach Ring server at https://api.ring.com/clients_api/ring_devices.  fetch failed.  Trying again in 5 seconds...

Screenshots

No response

Additional context

No response

OS

Ubuntu Focal (20.04.5 LTS)

Node.js Version

18.13.0

NPM Version

where to find ?

ring-client-api

13.1.0

Operating System

Docker

@pcziesch pcziesch added the bug Something isn't working label Oct 11, 2024
@tsightler
Copy link
Collaborator

tsightler commented Oct 11, 2024

Please upgrade to a supported version of NodeJS, ideally latest v20.18.0, and reupload logs.

However, I will note that there is clearly a network issue going on here as every single fetch fails, even those not made by homebridge-ring itself, for example, the message "Failed to connect push notification receiver", which means push-receiver could also not connect, and it also uses fetch. Something is blocking HTTPS network connections from this container.

I've had one report of this with a pfSense firewall that was running Snort, which somehow identified the traffic as bad and added a dynamic blocking rule.

@pcziesch
Copy link
Author

@tsightler i updated to the latest 20.18 and the issue remains. Just made a downgrade to 12.1 and now everthing works after setting up all cameras again.

@tsightler
Copy link
Collaborator

Downgrading to an old version doesn't really help to troubleshoot the problem. Older versions use an external library for making HTTP requests, because versions of Node prior to v18 did not have native fetch. Version 13 and later support native fetch, which is now natively supported in NodeJS v18 and later, but for some reason that is failing for you. The only way to solve the problem is to troubleshoot why fetch is failing for you, otherwise no future version will ever work again.

Also, old versions are unlikely to stay working with ding and push notifications because the old push notification format is deprecated. Don't know when Ring will completely kill it, but it will happen at some point (at least for some people it seems to have already happened).

If you are unable/unwilling to work on troubleshooting the issue, I will close it.

@pcziesch
Copy link
Author

@tsightler don't understand me wrong of course i want to help solving the issue but in first step it should run everything like before. what can i do please advise i am not the specialist in networking and co.

@pcziesch
Copy link
Author

@tsightler i can setup a second docker with only ring plugin for testing and evaluating, because there will be the same issue

@tsightler
Copy link
Collaborator

tsightler commented Oct 12, 2024

@pcziesch Thanks. Can you share some additional details of your setup, for example, above you state Ubuntu 20.04.5 (pretty old), what version of Docker are you running? Does that system run as a VM, if so, what is the hypervisor host and version?

Also, what is the networking configuration, what hardware, firewall/gateway, etc?

@pcziesch
Copy link
Author

pcziesch commented Oct 13, 2024

ok docker ist the QNAP docker station in version Version 3.0.8.981 (2024/09/13). Image is the oznu/homebridge image in latest version installed. homebridge docker is bridged to the ip of the NAS. I hope this helps for info
internet connection via cable and fritzbox 6690 with latest stable image. NAS/docker has a static ip

@SpencerKaiser
Copy link

I’m having the exact same issue; everything has been down for me for a few days now…

Docker 24.0.7

Networking config: AT&T fiber modem/router combo in bridge mode with an Eero router as the main network. Raspi has a static IP and no other plugins have issues.

I can provide more details on the OS setup if you provide commands to run, but it’s just a basic install of HomeBridge on a raspi.

@pcziesch
Copy link
Author

pcziesch commented Oct 13, 2024

@tsightler i tried today another docker homebridge with ubuntu 22.04.5 and ring plugin 13.1 and had same issue so seems to be not an ubuntu issue. after dwongrade to 12.1 everthing is fine

@tsightler
Copy link
Collaborator

@SpencerKaiser

I’m having the exact same issue; everything has been down for me for a few days now…

While I appreciate sharing your details, you did not provide any logs so I will not assume that you have the exact same issue as "everything has been down" can be caused by many different issues so you may have the exact same symptom, but not the same issue, and that just causes confusion. Please post logs showing showing you have the exact same issue or your comment will be marked as off-topic.

@tsightler
Copy link
Collaborator

@pcziesch I've been doing some research to try to understand what might cause this issue since ring-client-api and push-receiver are just using native fetch in NodeJS so there's not really much that can be done from a code perspective as the error is coming from the fetch function call itself. Underneath the covers, native fetch in NodeJS is based on a minimal version of Undici, and there are a few similar reports on that project.

The vast majority of these reports boil down to DNS or IPv6 issues, or some combination of interaction between those two. It seems that native fetch is not as robust as some of the other http clients out there, and will default to trying IPv6. If IPv6 is enabled, but not configured to actually work, it takes too long to timeout and will never fall back to IPv4, ending up with the connection error.

Are you comfortable enough with the command line to get access to the running container to run some commands in it?

@pcziesch
Copy link
Author

pcziesch commented Oct 13, 2024

@tsightler so you want me to enter some telnet commands on the nas right. i will give it a try if i get a proper advise for advanced users. maybe it will take some time in some cases because i have to read first and than try out

@tsightler
Copy link
Collaborator

tsightler commented Oct 13, 2024

@pcziesch I'm trying to understand your setup clearly in the hope that maybe I can somewhat reproduce this issue. You say you are using QNAP Docker Station, but then there's also an Ubuntu VM? Are you running Ubuntu VM on QNAP then Docker inside Ubuntu VM? I was under the impression that Docker Station would run the docker containers directly.

@tsightler
Copy link
Collaborator

@pcziesch Maybe another question, do you have Discord or some other way to direct message? Would you be willing to setup a time for a remote session so that I remotely see and understand your setup and perhaps try to troubleshoot interactively? Note that I understand if you are not willing to do this, but it might save some time on both sides. I'm very interested in getting to the bottom if this issue as it just makes very little sense to me.

@pcziesch
Copy link
Author

@tsightler what i see is an app in qnap called docker station where you can install docker like himebridge all in wysiwyg. there is also an vm station on qnap which is not installed in my case
docker1

@pcziesch
Copy link
Author

docker2

@pcziesch
Copy link
Author

pcziesch commented Oct 13, 2024

@tsightler of course we can do an online session and i am willing to get of this issue. but i am not familar with discord , ms teams is on board and i am next week on a business trip so i cannot participate until end of next week maybe at the weekend

@tsightler
Copy link
Collaborator

@pcziesch OK, thanks for being willing to share. I have some ideas to look into, maybe a remote session would not be needed, but it's good to have that as a possible option. I'm also travelling for work next week, so understand the challenge there.

You've provided me some clues. For example, when you are stating the Ubuntu version, I believe you are referring to the version inside the container (i.e. what is shown in Homebridge Web UI), so that is more clear now and it sounds like you are using 'host' network mode. The onzu/homebridge container is outdated so it would be good to use the official homebridge/homebridge container for all testing.

I don't have a QNAP, but I can try to emulate this setup as closely as possible and see if I can figure out any way to reproduce.

@pcziesch
Copy link
Author

@tsightler you Right with your assumptions. I already have setup a docker with official Homebridge Image and one Ring device. So if there is something to Test Go for it.

@SpencerKaiser
Copy link

@SpencerKaiser

I’m having the exact same issue; everything has been down for me for a few days now…

While I appreciate sharing your details, you did not provide any logs so I will not assume that you have the exact same issue as "everything has been down" can be caused by many different issues so you may have the exact same symptom, but not the same issue, and that just causes confusion. Please post logs showing showing you have the exact same issue or your comment will be marked as off-topic.

HomeBridge makes it fairly difficult to copy logs when on mobile, but it's the same style of errors in logs; failed to reach Ring (on the same subscribe route as the description of the issue), fetch failed, trying again in 5 seconds.

There's literally no other details in the logs aside from that error over and over again with different numbers for the path param following doorbots.

Any other specifics you need?

@tsightler
Copy link
Collaborator

@SpencerKaiser Yes, I need to full logs from plugin startup until the first error, nothing else is really useful.

@SpencerKaiser
Copy link

And redact that path param I assume? Anything else non-obvious I should redact related to ring?

@tsightler
Copy link
Collaborator

You are free to redact whatever you feel is required, personally, I don't think there is anything of concern in the paths, they are just ids (I wouldn't paste, for example, my token, but people do that sometimes too). Ring clearly doesn't see device/location IDs as sensitive information or they wouldn't be in the URL to begin with (some are even visible in the web based Ring console).

If you have serious concerns you can feel free to send logs directly to my email, same username as here, but gmail.

@tsightler
Copy link
Collaborator

tsightler commented Oct 13, 2024

@pcziesch I have something I would like you to try when you get a chance. It's a bit of a long shot, but it will help me to remove one possible cause that keeps coming up in searches on this issue. Below are the steps:

  1. Open the Homebridge Web UI and navigate to the Settings tab
  2. Scroll down to Startup & Environment and locate the NODE_OPTIONS setting
  3. Enter the following exactly: --dns-result-order=ipv4first
  4. Restart Homebridge and provide a copy of the startup logs like you did in the OP

Almost every single case I can find of the 'UND_ERR_CONNECT_TIMEOUT' indicates that it is an issue with IPv6 being misconfigured, perhaps something like IPv6 being available but the firewall configured to drop all IPv6 traffic, just as an example (which is a common default in some devices). I actually don't see these Ring hosts resolve to IPv6 addresses in my environment, so I'm not convinced that is the issue here, but perhaps there are cases where they do as they appear to be using AWS load-balancing services. This should make the system prefer IPv4 addresses in all cases.

@pcziesch
Copy link
Author

pcziesch commented Oct 14, 2024

Here is the log after reboot

[10/14/2024, 5:21:59 AM] [HB Supervisor] Restarting Homebridge...
[10/14/2024, 5:21:59 AM] [HB Supervisor] Starting Homebridge with extra flags: -I -P /var/lib/homebridge/node_modules --strict-plugin-resolution
[10/14/2024, 5:21:59 AM] [HB Supervisor] Starting Homebridge with custom env: {"NODE_OPTIONS":"--dns-result-order=ipv4first"}
[10/14/2024, 5:21:59 AM] [HB Supervisor] Started Homebridge v1.8.4 with PID: 1106
[10/14/2024, 5:21:59 AM] Loaded config.json with 0 accessories and 2 platforms.
[10/14/2024, 5:21:59 AM] Loaded 1 cached accessories from cachedAccessories.
[10/14/2024, 5:21:59 AM] ---
[10/14/2024, 5:22:00 AM] Loaded plugin: [email protected]
[10/14/2024, 5:22:00 AM] Registering platform 'homebridge-ring.Ring'
[10/14/2024, 5:22:00 AM] ---
[10/14/2024, 5:22:00 AM] Loading 2 platforms...
[10/14/2024, 5:22:00 AM] [Ring] Initializing Ring platform...
[10/14/2024, 5:22:00 AM] [Ring] Configuring cached accessory number Obergeschoss
Setup Payload:
X-HM://number
Enter this code with your HomeKit app on your iOS device to pair with Homebridge:

┌────────────┐     
│ xxx-xx-xxx │     
└────────────┘     

[10/14/2024, 5:22:00 AM] Homebridge v1.8.4 (HAP v0.12.2) (Homebridge xxxx) is running on port 51792.
[10/14/2024, 5:22:00 AM]

NOTICE TO USERS AND PLUGIN DEVELOPERS

Homebridge 2.0 is on the way and brings some breaking changes to existing plugins.
Please visit the following link to learn more about the changes and how to prepare:
https://github.com/homebridge/homebridge/wiki/Updating-To-Homebridge-v2.0

[10/14/2024, 5:22:13 AM] [Ring] Found the following locations:
[10/14/2024, 5:22:13 AM] [Ring] locationId: number - location
[10/14/2024, 5:22:26 AM] [Ring] Configuring 1 cameras and 1 devices for location "location" - locationId: number

ring camera works. after installing the 13.1 plugin version i had the same fetching failures

@tsightler
Copy link
Collaborator

tsightler commented Oct 14, 2024

@pcziesch Sorry for not being clear, I was looking for logs of the 13.1 version. Mainly I want to see if push-receiver also fails in 13.1 after making the change, or just Ring API (basically, is there any change in behavior at all from that setting).

@tsightler
Copy link
Collaborator

@SpencerKaiser Can you tell me a bit more about your install? You state you have static IP, do you have both IPv4 and IPv6 setup? What are the DNS server settings? What specific OS is installed and what model RPi? Which docker image are you using and what instructions did you follow it install docker? I have both a spare RPi3 and RPi4, so I'm thinking I might be able to duplicate your setup more closely as I don't own a QNAP.

That being said, I don't think these are the issue, I think it is something firewall related instead as the failures are happening at the TCP connection level, way lower than any code written here.

@pcziesch
Copy link
Author

@tsightler sorry i will Dad the log with 13.1 later this day.

@SpencerKaiser
Copy link

@tsightler sorry for the delay, I had a crazy weekend and haven't had time to sit down with the laptop. I'll dig in this afternoon and get logs and all the environmental stuff you asked about above.

Quick unexpected update: everything works again....... I didn't change anything, didn't restart, and did nothing on the HB/software side of things. I feel like there's zero chance this is relevant, but just in case: I replaced batteries in my smart lock (which was dead) and replaced the battery in my doorbell (which was ~10%) and immediately after that everything was working again 🫣

@pcziesch
Copy link
Author

[10/28/2024, 6:29:14 PM] Loaded config.json with 0 accessories and 2 platforms.
[10/28/2024, 6:29:14 PM] Loaded 1 cached accessories from cachedAccessories.
[10/28/2024, 6:29:14 PM] Loaded 1 cached accessories from cachedAccessories.
[10/28/2024, 6:29:14 PM] ---
[10/28/2024, 6:29:16 PM] Loaded plugin: [email protected]
[10/28/2024, 6:29:16 PM] Registering platform 'homebridge-ring.Ring'
[10/28/2024, 6:29:16 PM] ---
[10/28/2024, 6:29:16 PM] Loading 2 platforms...
[10/28/2024, 6:29:16 PM] [Ring] Initializing Ring platform...
[10/28/2024, 6:29:16 PM] [Ring] Configuring cached accessory „number“
Setup Payload:
X-HM://number
Enter this code with your HomeKit app on your iOS device to pair with Homebridge:

┌────────────┐     
│ │     
└────────────┘     

[10/28/2024, 6:29:16 PM] Homebridge v1.8.5 (HAP v0.12.3) (Homebridge 8601) is running on port 51563.
[10/28/2024, 6:29:16 PM]

NOTICE TO USERS AND PLUGIN DEVELOPERS

Homebridge 2.0 is on the way and brings some breaking changes to existing plugins.
Please visit the following link to learn more about the changes and how to prepare:
https://github.com/homebridge/homebridge/wiki/Updating-To-Homebridge-v2.0

[10/28/2024, 6:29:38 PM] [Ring] Found the following locations:
[10/28/2024, 6:29:38 PM] [Ring] locationId:number
[10/28/2024, 6:29:48 PM] [Ring] Failed to reach Ring server at https://api.ring.com/clients_api/doorbots/564066830/motions_subscribe. fetch failed. Trying again in 5 seconds...
[10/28/2024, 6:29:48 PM] [Ring] TypeError: fetch failed
at node:internal/deps/undici/undici:13185:13
at processTicksAndRejections (node:internal/process/task_queues:95:5)
at requestWithRetry (/homebridge/node_modules/homebridge-ring/node_modules/ring-client-api/lib/rest-client.js:80:26)
at RingRestClient.request (/homebridge/node_modules/homebridge-ring/node_modules/ring-client-api/lib/rest-client.js:344:20) {
[cause]: ConnectTimeoutError: Connect Timeout Error
at onConnectTimeout (node:internal/deps/undici/undici:2331:28)
at node:internal/deps/undici/undici:2283:50
at Immediate._onImmediate (node:internal/deps/undici/undici:2315:13)
at processImmediate (node:internal/timers:483:21) {
code: 'UND_ERR_CONNECT_TIMEOUT'
}
}
[10/28/2024, 6:29:48 PM] [Ring] Failed to reach Ring server at https://prd-api-us.prd.rings.solutions/api/v1/mode/location/location. fetch failed. Trying again in 5 seconds...
[10/28/2024, 6:29:48 PM] [Ring] TypeError: fetch failed
at node:internal/deps/undici/undici:13185:13
at processTicksAndRejections (node:internal/process/task_queues:95:5)
at requestWithRetry (/homebridge/node_modules/homebridge-ring/node_modules/ring-client-api/lib/rest-client.js:80:26)
at RingRestClient.request (/homebridge/node_modules/homebridge-ring/node_modules/ring-client-api/lib/rest-client.js:344:20)
at Location.getLocationMode (/homebridge/node_modules/homebridge-ring/node_modules/ring-client-api/lib/location.js:294:26) {
[cause]: ConnectTimeoutError: Connect Timeout Error
at onConnectTimeout (node:internal/deps/undici/undici:2331:28)
at node:internal/deps/undici/undici:2283:50
at Immediate._onImmediate (node:internal/deps/undici/undici:2315:13)
at processImmediate (node:internal/timers:483:21) {
code: 'UND_ERR_CONNECT_TIMEOUT'
}
}
[10/28/2024, 6:29:48 PM] [Ring] Failed to reach Ring server at https://prd-api-us.prd.rings.solutions/api/v1/mode/location/location. fetch failed. Trying again in 5 seconds...
[10/28/2024, 6:29:48 PM] [Ring] TypeError: fetch failed
at node:internal/deps/undici/undici:13185:13
at processTicksAndRejections (node:internal/process/task_queues:95:5)
at requestWithRetry (/homebridge/node_modules/homebridge-ring/node_modules/ring-client-api/lib/rest-client.js:80:26)
at RingRestClient.request (/homebridge/node_modules/homebridge-ring/node_modules/ring-client-api/lib/rest-client.js:344:20)
at Location.getLocationMode (/homebridge/node_modules/homebridge-ring/node_modules/ring-client-api/lib/location.js:294:26)
at Location.supportsLocationModeSwitching (/homebridge/node_modules/homebridge-ring/node_modules/ring-client-api/lib/location.js:355:30)
at /homebridge/node_modules/homebridge-ring/lib/ring-platform.js:200:18
at async Promise.all (index 0)
at RingPlatform.connectToApi (/homebridge/node_modules/homebridge-ring/lib/ring-platform.js:168:9) {
[cause]: ConnectTimeoutError: Connect Timeout Error
at onConnectTimeout (node:internal/deps/undici/undici:2331:28)
at node:internal/deps/undici/undici:2283:50
at Immediate._onImmediate (node:internal/deps/undici/undici:2315:13)
at processImmediate (node:internal/timers:483:21) {
code: 'UND_ERR_CONNECT_TIMEOUT'
}
}
Message dropped as it could not be decrypted: crypto-key is missing
[10/28/2024, 6:29:54 PM] [Ring] Ignoring push notification received in first two seconds after starting up
[10/28/2024, 6:29:54 PM] [Ring] Ignoring push notification received in first two seconds after starting up
[10/28/2024, 6:29:54 PM] [Ring] Ignoring push notification received in first two seconds after starting up
[10/28/2024, 6:29:54 PM] [Ring] Ignoring push notification received in first two seconds after starting up
[10/28/2024, 6:29:54 PM] [Ring] Ignoring push notification received in first two seconds after starting up
[10/28/2024, 6:29:54 PM] [Ring] Ignoring push notification received in first two seconds after starting up
[10/28/2024, 6:29:54 PM] [Ring] Ignoring push notification received in first two seconds after starting up
[10/28/2024, 6:30:02 PM] [Ring] Location Mode: {"mode":"unset","securityStatus":{},"readOnly":true,"notYetParticipatingInMode":[],"responseTimestamp":1730136602000}
[10/28/2024, 6:30:02 PM] [Ring] Configuring 1 cameras and 1 devices for location "" - locationId: id
[10/28/2024, 6:30:02 PM] [Ring] Bridged camera support will be removed in the next major release of homebridge-ring. Please enable the unbridgeCameras option in your configuration and add the individual cameras to HomeKit to prepare for this change.
[10/28/2024, 6:30:04 PM] [Ring] Failed to reach Ring server at https://api.ring.com/clients_api/device. fetch failed. Trying again in 5 seconds...
[10/28/2024, 6:30:04 PM] [Ring] TypeError: fetch failed
at node:internal/deps/undici/undici:13185:13
at processTicksAndRejections (node:internal/process/task_queues:95:5)
at requestWithRetry (/homebridge/node_modules/homebridge-ring/node_modules/ring-client-api/lib/rest-client.js:80:26)
at RingRestClient.request (/homebridge/node_modules/homebridge-ring/node_modules/ring-client-api/lib/rest-client.js:344:20)
at Object.next (/homebridge/node_modules/homebridge-ring/node_modules/ring-client-api/lib/api.js:156:17) {
[cause]: ConnectTimeoutError: Connect Timeout Error
at onConnectTimeout (node:internal/deps/undici/undici:2331:28)
at node:internal/deps/undici/undici:2283:50
at Immediate._onImmediate (node:internal/deps/undici/undici:2315:13)
at processImmediate (node:internal/timers:483:21) {
code: 'UND_ERR_CONNECT_TIMEOUT'
}
}
[10/28/2024, 6:30:08 PM] [Ring] Failed to reach Ring server at https://api.ring.com/clients_api/ring_devices. fetch failed. Trying again in 5 seconds...
[10/28/2024, 6:30:08 PM] [Ring] TypeError: fetch failed
at node:internal/deps/undici/undici:13185:13
at processTicksAndRejections (node:internal/process/task_queues:95:5)
at requestWithRetry (/homebridge/node_modules/homebridge-ring/node_modules/ring-client-api/lib/rest-client.js:80:26)
at RingRestClient.request (/homebridge/node_modules/homebridge-ring/node_modules/ring-client-api/lib/rest-client.js:344:20)
at RingApi.fetchRingDevices (/homebridge/node_modules/homebridge-ring/node_modules/ring-client-api/lib/api.js:39:185) {
[cause]: ConnectTimeoutError: Connect Timeout Error
at onConnectTimeout (node:internal/deps/undici/undici:2331:28)
at node:internal/deps/undici/undici:2283:50
at Immediate._onImmediate (node:internal/deps/undici/undici:2315:13)
at processImmediate (node:internal/timers:483:21) {
code: 'UND_ERR_CONNECT_TIMEOUT'
}
}
[10/28/2024, 6:30:08 PM] [Ring] Failed to reach Ring server at https://prd-api-us.prd.rings.solutions/api/v1/mode/location/location. fetch failed. Trying again in 5 seconds...
[10/28/2024, 6:30:08 PM] [Ring] TypeError: fetch failed
at node:internal/deps/undici/undici:13185:13
at processTicksAndRejections (node:internal/process/task_queues:95:5)
at requestWithRetry (/homebridge/node_modules/homebridge-ring/node_modules/ring-client-api/lib/rest-client.js:80:26)
at RingRestClient.request (/homebridge/node_modules/homebridge-ring/node_modules/ring-client-api/lib/rest-client.js:344:20)
at Location.getLocationMode (/homebridge/node_modules/homebridge-ring/node_modules/ring-client-api/lib/location.js:294:26) {
[cause]: ConnectTimeoutError: Connect Timeout Error
at onConnectTimeout (node:internal/deps/undici/undici:2331:28)
at node:internal/deps/undici/undici:2283:50
at Immediate._onImmediate (node:internal/deps/undici/undici:2315:13)
at processImmediate (node:internal/timers:483:21) {
code: 'UND_ERR_CONNECT_TIMEOUT'
}
}

@tsightler
Copy link
Collaborator

At @pcziesch, thanks for that. Did you happen to cut anything out of this log? Specificaly, on the "[cause]:" line I would expect there to be a list of IP addresses that were tried.

@pcziesch
Copy link
Author

@tsightler nothing cut out except of location id

@tsightler
Copy link
Collaborator

Thanks @pcziesch. Guess I need to check that, maybe it only logs IP on newer NodeJS versions.

@tsightler
Copy link
Collaborator

@pcziesch I have been doing a lot of research on this issue and, unfortunately, I have to ask a few more questions.

  1. In your original post to this issue all external connections appear to fail. For example there is this line:
    [10/11/2024, 6:41:42 AM] [Homebridge UI] [homebridge-config-ui-x] Failed to check registry.npmjs.org for updates: "timeout of 10000ms exceeded" - see https://homebridge.io/w/JJSz6 for help.
    Do you see this everytime as well because that would indicate serious issues with the container accessing the Internet.

  2. I was able to find one weird bug with Undici (the library which forms the basis for NodeJS fetch implementation) that would timeout unexpectedly when the timezone was wrong. Is you container showing your correct local time in logs? Any chance it is in GMT?

  3. I know you mentioned Fritzbox, any chance you are using anything like Eero for wifi?

@pcziesch
Copy link
Author

pcziesch commented Oct 29, 2024

@tsightler
1.--> yes error is everytime
2. -->
docker_time
time of container matches local and NAS time
3. --> difficult to arrange need first to buy a usb wifi dongle to coinnect via smartphone homespot

@tsightler
Copy link
Collaborator

tsightler commented Oct 29, 2024

@pcziesch Thanks. To clarify point 3, I wasn't asking you to change anything or go through any effort, I was just asking if you were using something additional for mesh wifi, like the Eero, as I found some documents describing issues there when they have their advanced app security features turned on.

The fact that your standard installation works fine would imply that the firewall is seemingly not the issue.

I found one matching issue on the NodeJS project page which was fixed in later versions of Undici, but those are not yet merged into most released versions of NodeJS (only NodeJS 22.10.0 has the fix so far).

However, the fact that your container instance also can't reach registry.npmjs.org, which has nothing to do with homebridge-ring, indicates to me that something is more widely impacting network connectivity within that container, I'm just not sure what.

@pcziesch
Copy link
Author

@tsightler i assume the Same that something is with the Container App . I‘ll Check if i can Downloads the Version to Test a previous Version

@tsightler
Copy link
Collaborator

Yeah, I doubt that it is the container itself, my guess is something networking wise is causing it, I'm just not sure what as I'm not that familiar with the QNAP. One thing you can do is run with NODE_DEBUG=net. Just add NODE_DEBUG to your Docker environment for the container, set the value to "net" and restart the container. This will dramatically change the debug logging out, but will show the actual TCP level connection attempts. This might tell us something.

@pcziesch
Copy link
Author

pcziesch commented Oct 29, 2024

@tsightler a lot to read , sorry

<-- Snipped logs -->

@tsightler
Copy link
Collaborator

tsightler commented Oct 29, 2024

Hi @pcziesch, thanks so much for all of your efforts here. I removed the logs from the post (saved locally) just because they were so long and make it difficult to read this thread, but they are very interesting.

Initially, there are clearly few successful connections to the Ring API, but then, after 3-4 successful connections, it appears to stop immediately after a request to prd-api-us.prd.rings.solutions, which never appears to resolve, and then no other request after that successfully connect. What is weird is there's never even an actual connection attempt logged. I think it's because DNS stops responding (NodeJS doesn't cache any DNS requests by default so every request has to be resolved by the local DNS server).

Does the QNAP have any firewall services on it? Are you using any unusual/custom DNS configuration, for example something like PiHole? I believe that QNAP allows you to set custom DNS for docker0 network. Do you have anything configured there? Could you perhaps try using something like Google DNS there (8.8.8.8 and 8.8.4.4) and see what happens?

@pcziesch
Copy link
Author

pcziesch commented Oct 30, 2024

[@tsightler] you're welcome i hope at the end we'll find a solution which maybe help others too.

QNAP has its own firewall QUFirewall App which i deinstalled already which did not have any chaneg in behaviour of homebridge ring plugin. so still same issue.
there configuration via virtual switch to the networking adpater but nothing in deatil to set up. i will send an screenshot of settings later this day.

container_network1
container_network2
container_network3
container_network4

@tsightler
Copy link
Collaborator

Just for reference in case anyone else has clues here are some small snippets from the network debug logs. Initially, you can see a few connections:

NET 498: connect: find host api.ring.com
NET 498: connect: dns options { family: undefined, hints: 32 }
NET 498: connect: autodetecting
NET 498: _read - n 16384 isConnecting? true hasHandle? true
NET 498: _read wait for connection
NET 498: connect/multiple: will try the following addresses [
NET 498: connect/multiple: attempting to connect to 3.33.190.236:443 (addressType: 4)
NET 498: connect/multiple: setting the attempt timeout to 250 ms
NET 498: connect/multiple: connection attempt to 3.33.190.236:443 completed with status 0
NET 498: afterConnect
NET 498: _read - n 16384 isConnecting? false hasHandle? true
NET 498: Socket._handle.readStart

The log above shows what you would expect, NodeJS issues a low-level connect request for api.ring.com, DNS resolve, the connection shows as "isConnecting" to show that it is in progress, the code attempts to connect to the address, the connection attempt is successful (status 0), read starts once socket goes into connecting state.

There's ~4 of these successful connections, and then a different pattern emerges:

NET 498: connect: find host api.ring.com
NET 498: connect: dns options { family: undefined, hints: 32 }
NET 498: connect: autodetecting
NET 498: _read - n 16384 isConnecting? true hasHandle? true
NET 498: _read wait for connection
<--Some time passes-->
NET 498: destroy
NET 498: close
NET 498: close handle
NET 498: emit close

At this stage it never even attempts to connect, but I have no idea why. I'm assuming it could be because DNS is not able to resolve the address, but I don't know this for a fact, nor do I understand why it would work a few times and then stop working. This is very low-level function in NodeJS itself. I'm really struggling for ideas here.

@tsightler
Copy link
Collaborator

tsightler commented Oct 30, 2024

@pcziesch Yet another request, while running the container with the 13.1.0 plugin in the non-working state, can you please open the terminal via the Homebridge Web UI and run the following commands, and post the results:

wget https://api.ring.com

and then

wget https://prd-api-us.prd.rings.solutions

I would expect both of these to return a 404, but any results would be helpful. Then I would ask that you run the following commands as well:

node -e 'fetch ("https://api.ring.com");'

and then

node -e 'fetch ("https://prd-api-us.prd.rings.solutions");'

These commands should produce no output if they are successful, but I'd be very interested in any errors.

@pcziesch
Copy link
Author

@tsightler see output below

root@xxx:/var/lib/homebridge $ wget https://api.ring.com
--2024-10-30 17:12:03-- https://api.ring.com/
Resolving api.ring.com (api.ring.com)... 3.33.190.236, 15.197.187.26
Connecting to api.ring.com (api.ring.com)|3.33.190.236|:443... connected.
HTTP request sent, awaiting response... 404 Not Found
2024-10-30 17:12:08 ERROR 404: Not Found.

root@xxx:/var/lib/homebridge $ wget https://prd-api-us.prd.rings.solutions
--2024-10-30 17:12:17-- https://prd-api-us.prd.rings.solutions/
Resolving prd-api-us.prd.rings.solutions (prd-api-us.prd.rings.solutions)... 54.164.58.131, 18.215.79.104, 34.225.66.79, ...
Connecting to prd-api-us.prd.rings.solutions (prd-api-us.prd.rings.solutions)|54.164.58.131|:443... connected.
HTTP request sent, awaiting response... 404 Not Found
2024-10-30 17:12:21 ERROR 404: Not Found.

root@xxx:/var/lib/homebridge $ node -e 'fetch ("https://api.ring.com");'
NET 299: pipe false undefined
NET 299: connect: find host api.ring.com
NET 299: connect: dns options { family: undefined, hints: 32 }
NET 299: connect: autodetecting
NET 299: _read - n 16384 isConnecting? true hasHandle? true
NET 299: _read wait for connection
NET 299: connect/multiple: will try the following addresses [
{ address: '15.197.187.26', family: 4 },
{ address: '3.33.190.236', family: 4 }
]
NET 299: connect/multiple: attempting to connect to 15.197.187.26:443 (addressType: 4)
NET 299: connect/multiple: setting the attempt timeout to 250 ms
NET 299: connect/multiple: connection attempt to 15.197.187.26:443 completed with status 0
NET 299: afterConnect
NET 299: _read - n 16384 isConnecting? false hasHandle? true
NET 299: Socket._handle.readStart
NET 299: _read - n 16384 isConnecting? false hasHandle? true
root@xxx:/var/lib/homebridge $ node -e 'fetch ("https://prd-api-us.prd.rings.solutions");'
NET 319: pipe false undefined
NET 319: connect: find host prd-api-us.prd.rings.solutions
NET 319: connect: dns options { family: undefined, hints: 32 }
NET 319: connect: autodetecting
NET 319: _read - n 16384 isConnecting? true hasHandle? true
NET 319: _read wait for connection
NET 319: connect/multiple: will try the following addresses [
{ address: '54.164.58.131', family: 4 },
{ address: '18.215.79.104', family: 4 },
{ address: '34.225.66.79', family: 4 },
{ address: '3.92.148.75', family: 4 },
{ address: '3.229.184.211', family: 4 },
{ address: '35.168.229.64', family: 4 }
]
NET 319: connect/multiple: attempting to connect to 54.164.58.131:443 (addressType: 4)
NET 319: connect/multiple: setting the attempt timeout to 250 ms
NET 319: connect/multiple: connection attempt to 54.164.58.131:443 completed with status 0
NET 319: afterConnect
NET 319: _read - n 16384 isConnecting? false hasHandle? true
NET 319: Socket._handle.readStart
NET 319: _read - n 16384 isConnecting? false hasHandle? true
NET 319: _read - n 16384 isConnecting? false hasHandle? true
root@xxx:/var/lib/homebridge $

@tsightler
Copy link
Collaborator

tsightler commented Oct 30, 2024

@pcziesch Hmm...more interesting as that all shows success so it doesn't look like a network or firewall issue, it's like something in NodeJS itself is failing. Can you post the output of:

uname -a

and

free

@pcziesch
Copy link
Author

root@845eea546da1:/var/lib/homebridge $ uname -a
Linux 845eea546da1 5.10.60-qnap #1 SMP Fri Oct 25 13:48:59 CST 2024 x86_64 x86_64 x86_64 GNU/Linux
root@xxx:/var/lib/homebridge $ free
total used free shared buff/cache available
Mem: 7976400 1922812 272724 376400 5780864 5196828
Swap: 24528440 33544 24494896

@pcziesch
Copy link
Author

@tsightler but why is it running with 12.1 ? that is the only difference

@tsightler
Copy link
Collaborator

tsightler commented Oct 30, 2024

@pcziesch As mentioned previously, versions of the plugin <13 use an external library for HTTPS requests (specifically, an older, outdated version of the got library). This was done because, prior to NodeJS 18, there was no native fetch() implementation, as is common in browsers, implemented in NodeJS.

However, over the years we've had plenty of similar issues with got, especially due to conflicts with older plugins that used different client libraries, etc. It was always a bit of a pain.

Node introduced the native fetch() API in Node 16 behind an experimental flag, and it was available by default in Node 18 and later. Many packages had already switched to it, including some upstream dependencies like push-receiver, so we decided v13 was a good opportunity to switch as well. Ideally, it would lead to less conflicts since it is a native feature.

So far, success is high in most cases. To give an example, the project I maintain (ring-mqtt) which depends on ring-client-api has over 10,000 installs of which >95% have been running v13 API for almost 2 months, and zero reports of this problem.

However, clearly there are some subtle cases where problems occur, I just can't wrap my brain around how. The code is quite simple here, actually the commands I had you run above are basically all the code is doing, but for some reason, it worked when you ran them individually, but fails in the main code after a period of time. At this point it feels like it has to be some kind of NodeJS issue, but I've not been able to find anything that really matches in the project Github, although there are a few reported issues that are somewhat similar.

What is more confusing is why does it work for 99% of cases, what is the environmental trigger. I just don't know.

@tsightler
Copy link
Collaborator

@pcziesch I would like to request that you try NodeJS 22, which just went LTS a few days ago. You should be able to upgrade easily by running this from the terminal:

hb-service update-node

Then restart homebridge using the UI. These changes are not persistent, if you restart the container they will be lost, so make sure to only use the restart option in the UI. I'm curious if the Undici updates in NodeJS 22 might address this issue.

@pcziesch
Copy link
Author

pcziesch commented Oct 30, 2024

@tsightler updated to v22.11 issue is Remaining 🤷‍♂️

@tsightler
Copy link
Collaborator

@pcziesch Thanks for testing. I didn't really expect it to change, but since it was easy to test, thought it would be worth the try just in case as fetch was marked fully stable in NodeJS 22. I've still got a few more things from the terminal when you get a chance.

netstat -ant4

Maybe even run this 3-4 times if you can, then a simple ping:

ping -M do -s 1472 -c1 api.ring.com

I'm really running out of ideas. Well, actually, I have quite a few more ideas of the potential cause, but I'd really like to figure out how to reproduce the issue because the other stuff I need to try requires modifying code to test things and that's quite hard to do without access to the system in question.

@pcziesch
Copy link
Author

@tsightler

root@xxx:/var/lib/homebridge $ netstat -ant4
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 127.0.0.11:38883 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:37019 0.0.0.0:* LISTEN
tcp 0 0 192.168.0.85:42024 104.16.0.35:443 ESTABLISHED
tcp 0 0 192.168.0.85:46062 104.16.29.34:443 ESTABLISHED
tcp 0 0 192.168.0.85:59436 3.33.190.236:443 TIME_WAIT
tcp 0 0 127.0.0.1:37019 127.0.0.1:52612 ESTABLISHED
tcp 0 0 192.168.0.85:59446 3.33.190.236:443 ESTABLISHED
tcp 0 0 192.168.0.85:33462 15.197.187.26:443 TIME_WAIT
tcp 0 0 192.168.0.85:33460 15.197.187.26:443 TIME_WAIT
tcp 0 0 127.0.0.1:52612 127.0.0.1:37019 ESTABLISHED
tcp 0 0 192.168.0.85:46064 104.16.29.34:443 ESTABLISHED
tcp 0 0 192.168.0.85:33446 15.197.187.26:443 TIME_WAIT
tcp 0 0 192.168.0.85:46060 104.16.29.34:443 ESTABLISHED
tcp 0 0 192.168.0.85:48012 64.233.184.188:5228 ESTABLISHED
root@xxx:/var/lib/homebridge $ netstat -ant4
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 127.0.0.11:38883 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:37019 0.0.0.0:* LISTEN
tcp 0 0 192.168.0.85:42024 104.16.0.35:443 ESTABLISHED
tcp 0 0 192.168.0.85:46062 104.16.29.34:443 ESTABLISHED
tcp 0 0 192.168.0.85:59436 3.33.190.236:443 TIME_WAIT
tcp 0 0 127.0.0.1:37019 127.0.0.1:52612 ESTABLISHED
tcp 0 0 192.168.0.85:59446 3.33.190.236:443 TIME_WAIT
tcp 0 0 192.168.0.85:33462 15.197.187.26:443 TIME_WAIT
tcp 0 0 192.168.0.85:44158 35.168.229.64:443 ESTABLISHED
tcp 0 0 192.168.0.85:33460 15.197.187.26:443 TIME_WAIT
tcp 0 0 127.0.0.1:52612 127.0.0.1:37019 ESTABLISHED
tcp 0 0 192.168.0.85:46064 104.16.29.34:443 ESTABLISHED
tcp 0 0 192.168.0.85:33446 15.197.187.26:443 TIME_WAIT
tcp 0 0 192.168.0.85:46060 104.16.29.34:443 ESTABLISHED
tcp 0 0 192.168.0.85:48012 64.233.184.188:5228 ESTABLISHED
root@xxx:/var/lib/homebridge $ netstat -ant4
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 127.0.0.11:38883 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:37019 0.0.0.0:* LISTEN
tcp 0 0 192.168.0.85:42024 104.16.0.35:443 ESTABLISHED
tcp 0 0 192.168.0.85:46062 104.16.29.34:443 ESTABLISHED
tcp 0 0 192.168.0.85:59436 3.33.190.236:443 TIME_WAIT
tcp 0 0 127.0.0.1:37019 127.0.0.1:52612 ESTABLISHED
tcp 0 0 192.168.0.85:59446 3.33.190.236:443 TIME_WAIT
tcp 0 0 192.168.0.85:33462 15.197.187.26:443 TIME_WAIT
tcp 0 0 192.168.0.85:33460 15.197.187.26:443 TIME_WAIT
tcp 0 0 127.0.0.1:52612 127.0.0.1:37019 ESTABLISHED
tcp 0 0 192.168.0.85:46064 104.16.29.34:443 ESTABLISHED
tcp 0 0 192.168.0.85:46060 104.16.29.34:443 ESTABLISHED
tcp 0 0 192.168.0.85:48012 64.233.184.188:5228 ESTABLISHED
root@xxx:/var/lib/homebridge $ netstat -ant4
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 127.0.0.11:38883 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:37019 0.0.0.0:* LISTEN
tcp 0 0 192.168.0.85:42024 104.16.0.35:443 ESTABLISHED
tcp 0 0 192.168.0.85:46062 104.16.29.34:443 ESTABLISHED
tcp 0 0 192.168.0.85:59436 3.33.190.236:443 TIME_WAIT
tcp 0 0 127.0.0.1:37019 127.0.0.1:52612 ESTABLISHED
tcp 0 0 192.168.0.85:59446 3.33.190.236:443 TIME_WAIT
tcp 0 0 192.168.0.85:33462 15.197.187.26:443 TIME_WAIT
tcp 0 0 192.168.0.85:33460 15.197.187.26:443 TIME_WAIT
tcp 0 0 127.0.0.1:52612 127.0.0.1:37019 ESTABLISHED
tcp 0 0 192.168.0.85:46064 104.16.29.34:443 ESTABLISHED
tcp 0 0 192.168.0.85:46060 104.16.29.34:443 ESTABLISHED
tcp 0 0 192.168.0.85:48012 64.233.184.188:5228 ESTABLISHED
root@xxx:/var/lib/homebridge $ ping -M do -s 1472 -c1 api.ring.com
PING a92f83bba7a172eaf.awsglobalaccelerator.com (3.33.190.236) 1472(1500) bytes of data.
1480 bytes from a92f83bba7a172eaf.awsglobalaccelerator.com (3.33.190.236): icmp_seq=1 ttl=249 time=22.3 ms

--- a92f83bba7a172eaf.awsglobalaccelerator.com ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 22.309/22.309/22.309/0.000 ms

@tsightler
Copy link
Collaborator

@pcziesch Just so I'm 100% clear, the system you installed on standalone Ubuntu works fine with 13.1 plugin, correct?

@pcziesch
Copy link
Author

pcziesch commented Oct 30, 2024

@pcziesch Just so I'm 100% clear, the system you installed on standalone Ubuntu works fine with 13.1 plugin, correct?

Yes absolutely no errors at all on Raspberry pi with 13.1

@tsightler
Copy link
Collaborator

OK, I'm going to stop after this one:

node -e 'const res = await fetch ("https://raw.githubusercontent.com/tsightler/ring-mqtt/dev/images/ring-mqtt-logo.png");console.log(res)'

@pcziesch
Copy link
Author

@tsightler

root@xxx:/var/lib/homebridge $ node -e 'const res = await fetch ("https://raw.githubusercontent.com/tsi
ghtler/ring-mqtt/images/ring.mqtt.logo.png");console.log(res)'
NET 7594: pipe false undefined
NET 7594: connect: find host raw.githubusercontent.com
NET 7594: connect: dns options { family: undefined, hints: 32 }
NET 7594: connect: autodetecting
NET 7594: _read - n 16384 isConnecting? true hasHandle? true
NET 7594: _read wait for connection
NET 7594: connect/multiple: will try the following addresses [
{ address: '185.199.108.133', family: 4 },
{ address: '185.199.111.133', family: 4 },
{ address: '185.199.110.133', family: 4 },
{ address: '185.199.109.133', family: 4 }
]
NET 7594: connect/multiple: attempting to connect to 185.199.108.133:443 (addressType: 4)
NET 7594: connect/multiple: setting the attempt timeout to 250 ms
NET 7594: connect/multiple: connection attempt to 185.199.108.133:443 completed with status 0
NET 7594: afterConnect
NET 7594: _read - n 16384 isConnecting? false hasHandle? true
NET 7594: Socket._handle.readStart
NET 7594: _read - n 16384 isConnecting? false hasHandle? true
Response {
status: 404,
statusText: 'Not Found',
headers: Headers {
connection: 'keep-alive',
'content-length': '14',
'content-security-policy': "default-src 'none'; style-src 'unsafe-inline'; sandbox",
'strict-transport-security': 'max-age=31536000',
'x-content-type-options': 'nosniff',
'x-frame-options': 'deny',
'x-xss-protection': '1; mode=block',
'content-type': 'text/plain; charset=utf-8',
'x-github-request-id': '1687:1E22D9:3AFE568:3D94514:67229B5D',
'accept-ranges': 'bytes',
date: 'Wed, 30 Oct 2024 20:47:25 GMT',
via: '1.1 varnish',
'x-served-by': 'cache-fra-eddf8230045-FRA',
'x-cache': 'MISS',
'x-cache-hits': '0',
'x-timer': 'S1730321245.459495,VS0,VE147',
vary: 'Authorization,Accept-Encoding,Origin',
'access-control-allow-origin': '*',
'cross-origin-resource-policy': 'cross-origin',
'x-fastly-request-id': 'cb904ede9a69e3cc79e009b03d0d7a2fc236283a',
expires: 'Wed, 30 Oct 2024 20:52:25 GMT',
'source-age': '0'
},
body: ReadableStream { locked: false, state: 'readable', supportsBYOB: true },
bodyUsed: false,
ok: false,
redirected: false,
type: 'basic',
url: 'https://raw.githubusercontent.com/tsightler/ring-mqtt/images/ring.mqtt.logo.png'
}
NET 7594: _read - n 16384 isConnecting? false hasHandle? true

@tsightler
Copy link
Collaborator

@pcziesch Hmm...somehow in the copy and paste of the URL was partially changed so this didn't test exactly what I was trying to test. Both the path is wrong and and there are periods instead of dashes in the filename. I was trying to get that specific URL because I'm trying to simulate a larger response as, from the logs, I can tell that the first few requests that work have very small response sizes, but the call to ring_devices is a much longer response and it seems like it's after that point that it hangs. so the test above is pulling a small image.

@pcziesch
Copy link
Author

pcziesch commented Oct 31, 2024

@tsightler tried it again with this result

root@xxx:/var/lib/homebridge $ node -e 'const res = await fetch ("https://raw.githubusercontent.com/tsightler/ring-mqtt/dev/images/ring-mqtt-logo.png");console.log(res)'
NET 15009: pipe false undefined
NET 15009: connect: find host raw.githubusercontent.com
NET 15009: connect: dns options { family: undefined, hints: 32 }
NET 15009: connect: autodetecting
NET 15009: _read - n 16384 isConnecting? true hasHandle? true
NET 15009: _read wait for connection
NET 15009: connect/multiple: will try the following addresses [
{ address: '185.199.110.133', family: 4 },
{ address: '185.199.108.133', family: 4 },
{ address: '185.199.109.133', family: 4 },
{ address: '185.199.111.133', family: 4 }
]
NET 15009: connect/multiple: attempting to connect to 185.199.110.133:443 (addressType: 4)
NET 15009: connect/multiple: setting the attempt timeout to 250 ms
NET 15009: connect/multiple: connection attempt to 185.199.110.133:443 completed with status 0
NET 15009: afterConnect
NET 15009: _read - n 16384 isConnecting? false hasHandle? true
NET 15009: Socket._handle.readStart
NET 15009: _read - n 16384 isConnecting? false hasHandle? true
Response {
status: 200,
statusText: 'OK',
headers: Headers {
connection: 'keep-alive',
'content-length': '48273',
'cache-control': 'max-age=300',
'content-security-policy': "default-src 'none'; style-src 'unsafe-inline'; sandbox",
'content-type': 'image/png',
etag: 'W/"a4b79c235925637d70f58d11368c15b0353e84e4b609db5ee661c33515729379"',
'strict-transport-security': 'max-age=31536000',
'x-content-type-options': 'nosniff',
'x-frame-options': 'deny',
'x-xss-protection': '1; mode=block',
'x-github-request-id': 'ACAD:16FF:4B1895A:4E6EDF4:6722F8B1',
'accept-ranges': 'bytes',
date: 'Thu, 31 Oct 2024 03:25:37 GMT',
via: '1.1 varnish',
'x-served-by': 'cache-fra-eddf8230034-FRA',
'x-cache': 'MISS',
'x-cache-hits': '0',
'x-timer': 'S1730345138.824376,VS0,VE141',
vary: 'Authorization,Accept-Encoding,Origin',
'access-control-allow-origin': '*',
'cross-origin-resource-policy': 'cross-origin',
'x-fastly-request-id': '9df4291cbed8f54e3f25a63480c05db5046d0e1d',
expires: 'Thu, 31 Oct 2024 03:30:37 GMT',
'source-age': '0'
},
body: ReadableStream { locked: false, state: 'readable', supportsBYOB: true },
bodyUsed: false,
ok: true,
redirected: false,
type: 'basic',
url: 'https://raw.githubusercontent.com/tsightler/ring-mqtt/dev/images/ring-mqtt-logo.png'
}
NET 15009: _read - n 16384 isConnecting? false hasHandle? true
NET 15009: _read - n 16384 isConnecting? false hasHandle? true
NET 15009: _read - n 16384 isConnecting? false hasHandle? true
NET 15009: _read - n 16384 isConnecting? false hasHandle? true
NET 15009: _read - n 16384 isConnecting? false hasHandle? true
NET 15009: _read - n 16384 isConnecting? false hasHandle? true
NET 15009: _read - n 16384 isConnecting? false hasHandle? true
NET 15009: _read - n 16384 isConnecting? false hasHandle? true
NET 15009: _read - n 16384 isConnecting? false hasHandle? true
NET 15009: _read - n 16384 isConnecting? false hasHandle? true
NET 15009: _read - n 16384 isConnecting? false hasHandle? true
NET 15009: _read - n 16384 isConnecting? false hasHandle? true
NET 15009: _read - n 16384 isConnecting? false hasHandle? true
NET 15009: _read - n 16384 isConnecting? false hasHandle? true
NET 15009: _read - n 16384 isConnecting? false hasHandle? true
NET 15009: _read - n 16384 isConnecting? false hasHandle? true
NET 15009: _read - n 16384 isConnecting? false hasHandle? true
NET 15009: _read - n 16384 isConnecting? false hasHandle? true
NET 15009: _read - n 16384 isConnecting? false hasHandle? true
NET 15009: _read - n 16384 isConnecting? false hasHandle? true
NET 15009: _read - n 16384 isConnecting? false hasHandle? true
NET 15009: _read - n 16384 isConnecting? false hasHandle? true
NET 15009: _read - n 16384 isConnecting? false hasHandle? true
NET 15009: _read - n 16384 isConnecting? false hasHandle? true
NET 15009: _read - n 16384 isConnecting? false hasHandle? true
NET 15009: _read - n 16384 isConnecting? false hasHandle? true
NET 15009: _read - n 16384 isConnecting? false hasHandle? true
NET 15009: _read - n 16384 isConnecting? false hasHandle? true
NET 15009: _read - n 16384 isConnecting? false hasHandle? true
NET 15009: _read - n 16384 isConnecting? false hasHandle? true
NET 15009: _read - n 16384 isConnecting? false hasHandle? true
NET 15009: _read - n 16384 isConnecting? false hasHandle? true
NET 15009: _read - n 16384 isConnecting? false hasHandle? true
NET 15009: _read - n 16384 isConnecting? false hasHandle? true
NET 15009: _read - n 16384 isConnecting? false hasHandle? true
NET 15009: _read - n 16384 isConnecting? false hasHandle? true
root@xxx:/var/lib/homebridge $

@tsightler
Copy link
Collaborator

Unfortunately, I don't think I'm going to be able to solve this issue unless someone can give me access to a system that is experiencing the problem. I know that is a big ask, but the next level of troubleshooting will require experimenting with various code tweaks to force some behaviors and there's no way I will be able to come up with one-liners for all of that.

Is there any chance that someone that is having an issue can provide me remote access to a system with the problem? We can do this a couple of ways, either something like Tailscale VPN, or even just a port forward that goes the Homebridge web UI on a test system (I have a static IP so it can be overall quite secure). I can even use a test system without an active token as I can try with my own account.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants