Home Assistant - High Memory Usage

You’ll need to run it inside the container

Hello everyone,

recently updated to version 0.112.4. With this version the crashes have started. To the HW:

  • Raspberry Pi 4 with 4GB with SSD (productive system)
  • Raspberry Pi 3B for Maria DB with USB stick (trial version)

The only new message in the log is:

2020-07-20 22:08:59 ERROR (MainThread) [homeassistant.components.discovery] Network is unreachable

Every 12 hours the RAM increases to >90%. The system reacts slowly. I have now created a node-red flow which reboots the host system at 90% RAM usage. It is always the container “homeassistant”. Pictures of this: (glances RAM)

chrome_JaBFcGx9m8

I will now try from @bdraco the idea for troubleshooting. Is it a general problem or am I looking for something only in my config?

It’s probably a bug in one of the integrations you are using. The py-spy might help point to the cause. If not, disabling one each day until the problem goes away can also track it down

Any better in 0.113.2 ?

For me I have 2 systems running, one main (Pi4 supervised) and a Proxmox HAOS install (with nothing else setup).

The main one seems to top out

image

The proxmox, just keeps climbing - part of the reason I have not migrated.

Which custom integrations do you have installed?

Samba on the Proxmox one.

How are you measuring ram usage?

Is it crashing?

Just on the Proxmox UI ATM. No it’s stable, but if the underlying install is doing this, I’m concerned moving everything across will be unpleasant. I have a fair bit running.

I haven’t use proxmox in a while, but I think it doesn’t subtract buffers/cache from ram usage. FKA https://www.linuxatemyram.com/

2 Likes

I had a feeling it might, but none of the other VM/Containers exhibit the same behaviour. I was going to spin up an Ubuntu VM and do a supervised install and see what happened.

Thanks for the link. On the proxmox system;

image

So seems fine and I learnt something :slight_smile:

Thanks @bdraco for your informationen. I tried a lot to figure out whats happend in my system. At the Moment I reduced the growing rate of the memory succesfully. It was the modul “Speedtest”. In the past i had to restart the system < 24 h to work normaly. Now as we can see in the picture the memory is growing per day by around 6%. So a restart every 1,5 weeks are enought.

This is good but totally new for me. Somehow I can’t understand why it keeps now growing so slowly. This just as feedback from me.

chrome_2020-08-07_08-57-00

I experienced exactly the same, huge memory rise during auto snap shots and won’t go down even after the backup. Hass would soon beome unresponsive. Need to reboot the VM to make it work. So so frustrating.

Hello all, I thought I had a memory leak as well when I looked at my proxmox summary but now I’m not sure. Does someone understand the difference between result in proxmox and glance?
Proxmox:
image

Glance in HA:

this is what I have seen too in all my mv in proxmox not only the one with home assistant. What I think is the OS will try to catch on RAM to skip reading the hdd. Still is available so but as proxmox can’t know what is on mv’s memory so it marks 91% memory used.
Once I discovered that I played increasing or decreasing memory on the mv and the behavior remains the same. It caches as much as possible and proxmox still will mark 90%. So I have my mv to have double the real memory they are using without adding the cache and everything works perfect.

As a summary look at the amount of memory available on the free command and trust the memory manager how it handles the cache.

3 Likes

What I see is crazy high cpu usage, with a load average of 5 (which is insane) and a memory usage that increases steady until it reaches the maximum I allowed the VM.
I don’t know what is going on, but it is not normal.
The only thing I did was install hassio as a virtual appliance and then restore an snapshot.

Can you post a py-spy https://github.com/home-assistant/core/issues/40292#issuecomment-704262499 and a callgrind.out using https://github.com/bdraco/profiler?

I’m installing py-spy, how should I execute it?

Find the right pid of python3 with top
And then

py-spy record --pid $(pidof python3) --duration 120 --output /config/www/spy.svg

example:

py-spy record --pid 230 --duration 120 --output /config/www/spy-0.116.0.svg