alexbelgium / hassio-addons

My homeassistant addons
MIT License
1.52k stars 214 forks source link

šŸ› [Scrutiny] Memory leak since 0.8.1, april 8 #1501

Closed chertvl closed 2 months ago

chertvl commented 2 months ago

Description

If I'm not mistaken, after the last Scrutiny update on April 8, a memory leak appeared, which has been slowly but surely growing for months.

I'll attach screenshots that show when the memory started leaking, and that the process /usr/libexec/udisks2/udisksd takes up 4.0% of my 16 GB of memory for 40 days of HAOS uptime. When HAOS is restarted, 1.5 GB of memory is occupied and this process is not visible at all in the top, and after a month and a half, it's already 2.8 GB and that procces at the top2. Unfortunately, restarting HA Core or restarting all my addons does not help to return the memory, only restarting the entire HAOS helps.

Alex, can you check if the problem exists on your side?

image

image

HW: Intel NUC10i3, HomeAssistantOS 12.4

Reproduction steps

1. Check used memory in SystemMonitor integration
2. Wait few weeks and check again, or show up history graph
3. You can check top10 process sorted by memory in Advanced SSH & Web Therminal by using command:

 run --privileged --rm -v /dev:/dev --pid host ubuntu:latest nsenter --target 1 --mount --uts --ipc --net --pid -- ps auxww --sort -pmem | head

Addon Logs

I dont have any.

Architecture

amd64

OS

HAos

andrewjswan commented 2 months ago

+1 the some

alexbelgium commented 2 months ago

Mmh very good point thanks. Alas I restart my homeassistant by automation weekly, and sometimes a bit more manually so I don't have long term data to compare. The is no mention of memory leaks in the scrutiny github, but there is some for HAos https://community.home-assistant.io/t/memory-leak-how-to-find-whats-causing-it/611482

I'll try to build a new version just to see if this helps by using updated dependencies

chertvl commented 2 months ago

I'll try to build a new version just to see if this helps by using updated dependencies

Thank you, hope it helps. ps: its a little hard to monitor processes memory use by all methods, because leakage around 30-35mb/day, it takes huge time to see real difference

alexbelgium commented 2 months ago

Might be easy for me to say but implementing a nightly weekly restart might avoid some issues... That's what I'm doing as part of my weekly maintenance routine...

BTW have you tried ha su repair? I know that the supervisor has some leftovers (such as dangling images) that are greatly helped by a regular run of this command... I wouldn't see how that would affect memory usage but at least it should recover some space for you :)

chertvl commented 2 months ago

Might be easy for me to say but implementing a nightly weekly restart might avoid some issues... That's what I'm doing as part of my weekly maintenance routine...

BTW have you tried ha su repair? I know that the supervisor has some leftovers (such as dangling images) that are greatly helped by a regular run of this command... I wouldn't see how that would affect memory usage but at least it should recover some space for you :)

Just updated to v0.8.1-4, tried ha su repair, will look in one week or so, will it growth... If nothing helps, I will implement host reboot every week, it will cause some another problems but I have ideas how to automate it.

Thanks! I'll write in one week about results.

github-actions[bot] commented 2 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

chertvl commented 2 months ago

image It seems the latest update didn't help. ha su repair command also does not bring results. Well, Iā€™ll have to implement the weekly OS reboot automation, apparently this is my last option. Alex, thank you for your work and time!

Ps: if the reason of this behavior will identified in the future, fill free to reopen issue