home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
71.11k stars 29.79k forks source link

Unifi protect is using 100% cpu of UDM after some access #113804

Closed stefanschaedeli closed 5 months ago

stefanschaedeli commented 5 months ago

The problem

The integration works great, but is causing stress on the UDM to the level where its not operating properly anymore. Capture on the red arrow I have restarted unifi protect app over SSH

What version of Home Assistant Core has the issue?

2024.3.1

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

Unifi Protect

Link to integration documentation on our website

https://www.home-assistant.io/integrations/unifiprotect

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

home-assistant[bot] commented 5 months ago

Hey there @angellusmortis, @bdraco, mind taking a look at this issue as it has been labeled with an integration (unifiprotect) you are listed as a code owner for? Thanks!

Code owner commands Code owners of `unifiprotect` can trigger bot actions by commenting: - `@home-assistant close` Closes the issue. - `@home-assistant rename Awesome new title` Renames the issue. - `@home-assistant reopen` Reopen the issue. - `@home-assistant unassign unifiprotect` Removes the current integration label and assignees on the issue, add the integration domain after the command. - `@home-assistant add-label needs-more-information` Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue. - `@home-assistant remove-label needs-more-information` Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


unifiprotect documentation unifiprotect source (message by IssueLinks)

AngellusMortis commented 5 months ago

@home-assistant add-label needs-more-information

AngellusMortis commented 5 months ago

Logs and diagnostics as asked for by the issue template.

stefanschaedeli commented 5 months ago

System Information

version core-2024.3.1
installation_type Home Assistant OS
dev false
hassio true
docker true
user root
virtualenv false
python_version 3.12.2
os_name Linux
os_version 6.6.20-haos
arch x86_64
timezone Europe/Zurich
config_dir /config
Home Assistant Community Store GitHub API | ok -- | -- GitHub Content | ok GitHub Web | ok GitHub API Calls Remaining | 5000 Installed Version | 1.34.0 Stage | running Available Repositories | 1416 Downloaded Repositories | 41 HACS Data | ok
Home Assistant Cloud logged_in | false -- | -- can_reach_cert_server | ok can_reach_cloud_auth | ok can_reach_cloud | ok
Home Assistant Supervisor host_os | Home Assistant OS 12.1 -- | -- update_channel | stable supervisor_version | supervisor-2024.03.0 agent_version | 1.6.0 docker_version | 24.0.7 disk_total | 97.7 GB disk_used | 14.1 GB healthy | true supported | true board | generic-x86-64 supervisor_api | ok version_api | ok installed_addons | File editor (5.8.0), Samba share (12.3.1), Node-RED (17.0.10), Grafana (9.2.0), Mosquitto broker (6.4.0), iPerf3 (0.1.0), Advanced SSH & Web Terminal (17.2.0), Vaultwarden (Bitwarden) (0.21.1), ESPHome (2024.2.2), NSPanel Manager (0.1.25), Music Assistant BETA (2.0.0b116), HoyMiles Solar Gateway Addon (1.0.11), Git pull (7.13.1), UniFi Network Application (3.0.3), modbus-proxy (1.0.18)
Dashboards dashboards | 3 -- | -- resources | 28 views | 64 mode | storage
Recorder oldest_recorder_run | February 13, 2024 at 09:21 -- | -- current_recorder_run | March 18, 2024 at 11:30 estimated_db_size | 11091.83 MiB database_engine | mysql database_version | 11.3.2
Spotify api_endpoint_reachable | ok -- | --
stefanschaedeli commented 5 months ago

home-assistant_unifiprotect_2024-03-19T22-32-37.391Z.log

stefanschaedeli commented 5 months ago

anything else in particular?

AngellusMortis commented 5 months ago

Logs and diagnostics as asked for by the issue template. It is pretty well laid out in the issue template how to generate both. You did not provide either.

msedge_Z20rxvunxJ

stefanschaedeli commented 5 months ago

sorry, I just looked at the form of a new issue and I don't see more details beside the diagnostic file that I uploaded? do you like generall log files to?

AngellusMortis commented 5 months ago

You did not provide the diagnostics file at all. Your logs you uploaded are also incomplete. There is only like 20 log lines from pyunifiprotect and 3 from unifiprotect. That means you either did not use the build in method as explained at that link or you only ran it for like 2 seconds.

If you want help, you need to provide actual data now just "it is broke, fix it".

stefanschaedeli commented 5 months ago

home-assistant_unifiprotect_2024-03-19T23-03-27.204Z.log config_entry-unifiprotect-624325e3f25fcc9793d98a9ecff43850.json

now with a longer run time on the debug and the diganostics as well

AngellusMortis commented 5 months ago

Nothing looks out of place, and it looks like a configuration/hardware issue. You are at 40% camera utilization, and I assume you are also running UniFi Network on the console as well since it is a UDM Pro. The camera utilization limits and recommendations assume you do not have Network running. So, 40% is basically maxed out if you are also using Network as Network pulls a lot more resources than Protect.

You also do not have RTSP enabled on one of your cameras and you are trying to live view the camera, which causes it to pull a snapshot every second.

There is nothing that can be done from Home Assistant's side. Recommendation is to enable RTSP for your missing camera and remove your live feeds from some dashboards to reduce the load of always keeping them up and running. Maybe do not preload all of them if you do not need them all. Turn off IDS/IPS if you have it enabled for UniFi Network. Otherwise, upgrade to a UNVR or UNVR Pro.

AngellusMortis commented 5 months ago

@home-assistant close

stefanschaedeli commented 5 months ago

Good catch with the camera that I forgot to config RTSP (was recently added). for some reason the behavior did not start immediately but a few weeks later.

What seems to have happend is that the snapshow was not done 1 ever second but more like 40x per second. maybe something to explore why home assistant did some may pulls for the same.

2024-03-20 19:39:28.019 DEBUG (MainThread) [pyunifiprotect.api] Request url: https://10.11.11.1/proxy/protect/api/cameras/65a995f002d5c303e40004a2/snapshot 2024-03-20 19:39:28.020 DEBUG (MainThread) [pyunifiprotect.api] Request url: https://10.11.11.1/proxy/protect/api/cameras/65a995f002d5c303e40004a2/snapshot 2024-03-20 19:39:28.066 DEBUG (MainThread) [pyunifiprotect.api] Request url: https://10.11.11.1/proxy/protect/api/cameras/65a995f002d5c303e40004a2/snapshot 2024-03-20 19:39:28.066 DEBUG (MainThread) [pyunifiprotect.api] Request url: https://10.11.11.1/proxy/protect/api/cameras/65a995f002d5c303e40004a2/snapshot 2024-03-20 19:39:28.068 DEBUG (MainThread) [pyunifiprotect.api] Request url: https://10.11.11.1/proxy/protect/api/cameras/65a995f002d5c303e40004a2/snapshot 2024-03-20 19:39:28.069 DEBUG (MainThread) [pyunifiprotect.api] Request url: https://10.11.11.1/proxy/protect/api/cameras/65a995f002d5c303e40004a2/snapshot 2024-03-20 19:39:28.139 DEBUG (MainThread) [pyunifiprotect.api] Request url: https://10.11.11.1/proxy/protect/api/cameras/65a995f002d5c303e40004a2/snapshot 2024-03-20 19:39:28.140 DEBUG (MainThread) [pyunifiprotect.api] Request url: https://10.11.11.1/proxy/protect/api/cameras/65a995f002d5c303e40004a2/snapshot 2024-03-20 19:39:28.168 DEBUG (MainThread) [pyunifiprotect.api] Request url: https://10.11.11.1/proxy/protect/api/cameras/65a995f002d5c303e40004a2/snapshot 2024-03-20 19:39:28.180 DEBUG (MainThread) [pyunifiprotect.api] Request url: https://10.11.11.1/proxy/protect/api/cameras/65a995f002d5c303e40004a2/snapshot 2024-03-20 19:39:28.182 DEBUG (MainThread) [pyunifiprotect.api] Request url: https://10.11.11.1/proxy/protect/api/cameras/65a995f002d5c303e40004a2/snapshot 2024-03-20 19:39:28.187 DEBUG (MainThread) [pyunifiprotect.api] Request url: https://10.11.11.1/proxy/protect/api/cameras/65a995f002d5c303e40004a2/snapshot 2024-03-20 19:39:28.189 DEBUG (MainThread) [pyunifiprotect.api] Request url: https://10.11.11.1/proxy/protect/api/cameras/65a995f002d5c303e40004a2/snapshot 2024-03-20 19:39:28.190 DEBUG (MainThread) [pyunifiprotect.api] Request url: https://10.11.11.1/proxy/protect/api/cameras/65a995f002d5c303e40004a2/snapshot 2024-03-20 19:39:28.228 DEBUG (MainThread) [pyunifiprotect.api] Request url: https://10.11.11.1/proxy/protect/api/cameras/65a995f002d5c303e40004a2/snapshot 2024-03-20 19:39:28.235 DEBUG (MainThread) [pyunifiprotect.api] Request url: https://10.11.11.1/proxy/protect/api/cameras/65a995f002d5c303e40004a2/snapshot 2024-03-20 19:39:28.260 DEBUG (MainThread) [pyunifiprotect.api] Request url: https://10.11.11.1/proxy/protect/api/cameras/65a995f002d5c303e40004a2/snapshot 2024-03-20 19:39:28.523 DEBUG (MainThread) [pyunifiprotect.api] Request url: https://10.11.11.1/proxy/protect/api/cameras/65a995f002d5c303e40004a2/snapshot 2024-03-20 19:39:28.525 DEBUG (MainThread) [pyunifiprotect.api] Request url: https://10.11.11.1/proxy/protect/api/cameras/65a995f002d5c303e40004a2/snapshot 2024-03-20 19:39:28.528 DEBUG (MainThread) [pyunifiprotect.api] Request url: https://10.11.11.1/proxy/protect/api/cameras/65a995f002d5c303e40004a2/snapshot 2024-03-20 19:39:28.567 DEBUG (MainThread) [pyunifiprotect.api] Request url: https://10.11.11.1/proxy/protect/api/cameras/65a995f002d5c303e40004a2/snapshot 2024-03-20 19:39:28.568 DEBUG (MainThread) [pyunifiprotect.api] Request url: https://10.11.11.1/proxy/protect/api/cameras/65a995f002d5c303e40004a2/snapshot 2024-03-20 19:39:28.570 DEBUG (MainThread) [pyunifiprotect.api] Request url: https://10.11.11.1/proxy/protect/api/cameras/65a995f002d5c303e40004a2/snapshot 2024-03-20 19:39:28.571 DEBUG (MainThread) [pyunifiprotect.api] Request url: https://10.11.11.1/proxy/protect/api/cameras/65a995f002d5c303e40004a2/snapshot 2024-03-20 19:39:28.572 DEBUG (MainThread) [pyunifiprotect.api] Request url: https://10.11.11.1/proxy/protect/api/cameras/65a995f002d5c303e40004a2/snapshot 2024-03-20 19:39:28.576 DEBUG (MainThread) [pyunifiprotect.api] Request url: https://10.11.11.1/proxy/protect/api/cameras/65a995f002d5c303e40004a2/snapshot 2024-03-20 19:39:28.578 DEBUG (MainThread) [pyunifiprotect.api] Request url: https://10.11.11.1/proxy/protect/api/cameras/65a995f002d5c303e40004a2/snapshot 2024-03-20 19:39:28.579 DEBUG (MainThread) [pyunifiprotect.api] Request url: https://10.11.11.1/proxy/protect/api/cameras/65a995f002d5c303e40004a2/snapshot 2024-03-20 19:39:28.625 DEBUG (MainThread) [pyunifiprotect.api] Request url: https://10.11.11.1/proxy/protect/api/cameras/65a995f002d5c303e40004a2/snapshot 2024-03-20 19:39:28.627 DEBUG (MainThread) [pyunifiprotect.api] Request url: https://10.11.11.1/proxy/protect/api/cameras/65a995f002d5c303e40004a2/snapshot 2024-03-20 19:39:28.629 DEBUG (MainThread) [pyunifiprotect.api] Request url: https://10.11.11.1/proxy/protect/api/cameras/65a995f002d5c303e40004a2/snapshot 2024-03-20 19:39:28.631 DEBUG (MainThread) [pyunifiprotect.api] Request url: https://10.11.11.1/proxy/protect/api/cameras/65a995f002d5c303e40004a2/snapshot 2024-03-20 19:39:28.645 DEBUG (MainThread) [pyunifiprotect.api] Request url: https://10.11.11.1/proxy/protect/api/cameras/65a995f002d5c303e40004a2/snapshot 2024-03-20 19:39:28.656 DEBUG (MainThread) [pyunifiprotect.api] Request url: https://10.11.11.1/proxy/protect/api/cameras/65a995f002d5c303e40004a2/snapshot 2024-03-20 19:39:28.735 DEBUG (MainThread) [pyunifiprotect.api] Request url: https://10.11.11.1/proxy/protect/api/cameras/65a995f002d5c303e40004a2/snapshot 2024-03-20 19:39:28.762 DEBUG (MainThread) [pyunifiprotect.api] Request url: https://10.11.11.1/proxy/protect/api/cameras/65a995f002d5c303e40004a2/snapshot 2024-03-20 19:39:28.766 DEBUG (MainThread) [pyunifiprotect.api] Request url: https://10.11.11.1/proxy/protect/api/cameras/65a995f002d5c303e40004a2/snapshot 2024-03-20 19:39:28.815 DEBUG (MainThread) [pyunifiprotect.api] Request url: https://10.11.11.1/proxy/protect/api/cameras/65a995f002d5c303e40004a2/snapshot 2024-03-20 19:39:28.847 DEBUG (MainThread) [pyunifiprotect.api] Request url: https://10.11.11.1/proxy/protect/api/cameras/65a995f002d5c303e40004a2/snapshot 2024-03-20 19:39:28.855 DEBUG (MainThread) [pyunifiprotect.api] Request url: https://10.11.11.1/proxy/protect/api/cameras/65a995f002d5c303e40004a2/snapshot 2024-03-20 19:39:28.935 DEBUG (MainThread) [pyunifiprotect.api] Request url: https://10.11.11.1/proxy/protect/api/cameras/65a995f002d5c303e40004a2/snapshot 2024-03-20 19:39:28.940 DEBUG (MainThread) [pyunifiprotect.api] Request url: https://10.11.11.1/proxy/protect/api/cameras/65a995f002d5c303e40004a2/snapshot 2024-03-20 19:39:28.943 DEBUG (MainThread) [pyunifiprotect.api] Request url: https://10.11.11.1/proxy/protect/api/cameras/65a995f002d5c303e40004a2/snapshot 2024-03-20 19:39:28.971 DEBUG (MainThread) [pyunifiprotect.api] Request url: https://10.11.11.1/proxy/protect/api/cameras/65a995f002d5c303e40004a2/snapshot 2024-03-20 19:39:28.972 DEBUG (MainThread) [pyunifiprotect.api] Request url: https://10.11.11.1/proxy/protect/api/cameras/65a995f002d5c303e40004a2/snapshot 2024-03-20 19:39:28.974 DEBUG (MainThread) [pyunifiprotect.api] Request url: https://10.11.11.1/proxy/protect/api/cameras/65a995f002d5c303e40004a2/snapshot 2024-03-20 19:39:28.975 DEBUG (MainThread) [pyunifiprotect.api] Request url: https://10.11.11.1/proxy/protect/api/cameras/65a995f002d5c303e40004a2/snapshot 2024-03-20 19:39:28.988 DEBUG (MainThread) [pyunifiprotect.api] Request url: https://10.11.11.1/proxy/protect/api/cameras/65a995f002d5c303e40004a2/snapshot 2024-03-20 19:39:28.991 DEBUG (MainThread) [pyunifiprotect.api] Request url: https://10.11.11.1/proxy/protect/api/cameras/65a995f002d5c303e40004a2/snapshot 2024-03-20 19:39:28.992 DEBUG (MainThread) [pyunifiprotect.api] Request url: https://10.11.11.1/proxy/protect/api/cameras/65a995f002d5c303e40004a2/snapshot 2024-03-20 19:39:28.995 DEBUG (MainThread) [pyunifiprotect.api] Request url: https://10.11.11.1/proxy/protect/api/cameras/65a995f002d5c303e40004a2/snapshot

JFYI: the other comments did no really apply. I would stop home assistant and the load from the UDM was down on 15% and it is so now as well after fixing the RTSP setting. The amount of cameras should be in range of the supported load.

stefanschaedeli commented 5 months ago

in any way, thank you very much for the support :)