Memory leak after updating to 2022.4?

If you use the default database option (the SQLite file in /config) then you would need to copy your db file somewhere else and copy it back after. Rolling back ha will restore the entire /config folder on including the db file. If you use an external db (like the mariadb addon) then just don’t restore that addon.

That being said, 2022.4 included a db migration. So I would not recommend rolling back ha and not the database. Especially in this case, this was a big one. Sometimes it’s just adding a new index which is probably fine in prior versions but this one completely changed how attributes were stored. I very much doubt a db migrated for 2022.4 would work in 2022.3.

I’ve been having memory leak issues since upgrading but I blamed it on Frigate. Restarting Frigate caused the two large drops below.

1 Like

Same issue after upgrading. It crashes after about 12 hours when memory is exhausted. I’m remote at the moment and can’t reboot it to show my integrations etc. however they are minimal.

According to GitHub issue, it’s traced down to stream integration, related to camera streams.
Disabling stream and restarting HA of course stopped memory leak. So hopefully, fix is not far.

Thank you, I just restored the whole backup (ok,lost two days of data,but it’s not the end of the world) and everything is fine now…waiting for the fixed release,so also my database will be upgraded.
Regards

The same here, after the upgrade to 2022.4.0 and 2022.4.1 the memory usage increases very fast.

2022.4.2 is out now with a fix for the camera stream memory leak.

I have upgraded to 2022.4.2. Hopefully, the memory leak problem is solved. Will notice within the next 24 hours.

1 Like

Thanks. I waiting for your test result.
P.S. Sorry for my bad english/

I thought the update fixed it, but after 2/3 days I’m still having the same issue.

My HA memory usage has stayed under 650MB.

On my HA the 2022.4.2 did solve the memory leak problem. Last 36 hours no increase of unexpected memory usage. Stable on average 50% percent. I have now updated the HA core to 2022.4.3.


Also for me 2022.4.2 update fixed the issue. Before the update I tried to disable all cameras as an first aid and that also worked for memory leak.
Now with update Onvif cameras are active and all is fine. After the update I did reboot the host if it matters.

Thanks for the HA team fo quick fix!

As an FYI for others: This leak is different and is being tracked here Memory Leak Persists After Core Upgrade 2022.4.2 · Issue #69934 · home-assistant/core · GitHub

Note that I’m still seeing a memory leak on the stream component in 2022.4.5. Not while running the stream itself, but when the stream gets started / restarted.

1 Like

Just wondering if any of you have gotten to the source of this?
I’ve been experiencing since 2022.4 as well, and just had another crash due to out of memory. I’ve now got 24Gb assigned to my VM since it was still crashing at 16. I used to have 8Gb assigned prior to last month.

You should open an issue on github if one isn’t already open regarding this.

I was experiencing this too. I noticed some errors in the supervisor log re. Samba add on although it was working ok. Since I stopped the addon last night my memory leak has vanished.

I observed that in my case is only buffered/cached memory.

on the HA host i run these command:

# free -h
               total        used        free      shared  **buff/cache**   available
Mem:           7.8Gi       1.3Gi       304Mi       4.0Mi       **6.2Gi**       6.4Gi
Swap:          2.6Gi        12Mi       2.5Gi


sync; echo 1 > /proc/sys/vm/drop_caches
sync; echo 2 > /proc/sys/vm/drop_caches
sync; echo 3 > /proc/sys/vm/drop_caches

# free -h
               total        used        free      shared  **buff/cache**   available
Mem:           7.8Gi       1.2Gi       6.2Gi       4.0Mi       **353Mi**       6.4Gi
Swap:          2.6Gi        12Mi       2.5Gi

I have had a memory leak on an 8GB Ubuntu Laptop for quite a while. HA running in Docker container.

Thank you for the commands to reduce the cache but I suspect that there is still a memory leak somewhere. After a few weeks it is impossible to use the system even via SSH.

Some time ago I had to increase the size of the swapfile something silly but the demand on physical memory and the paging renders the system unresponsive.

I have recorded the free stats and it grows daily. After decreasing the cache, here is the output from the free and top commands from within Docker:

Ubuntu-Laptop:/config# free -h
              total        used        free      shared  buff/cache   available
Mem:           7.6G        6.3G        1.0G       36.1M      327.8M        1.1G
Swap:          9.9G        1.8G        8.1G

Mem: 6914636K used, 1096464K free, 37044K shrd, 4832K buff, 260672K cached
CPU:   2% usr   0% sys   0% nic  97% idle   0% io   0% irq   0% sirq
Load average: 0.28 0.43 0.61 1/761 81002
  PID  PPID USER     STAT   VSZ %VSZ CPU %CPU COMMAND
  815    65 root     S    16.0g 208%   4   0% python3 -m homeassistant --config
80919     0 root     S     2612   0%   2   0% bash
81002 80919 root     R     1624   0%   4   0% top
    1     0 root     S      440   0%   6   0% {s6-svscan} /package/admin/s6/comm
   25     1 root     S      216   0%   3   0% s6-supervise s6rc-fdholder
   16     1 root     S      216   0%   5   0% s6-supervise s6-linux-init-shutdow
   26     1 root     S      216   0%   1   0% s6-supervise s6rc-oneshot-runner
   65     1 root     S      216   0%   6   0% s6-supervise home-assistant
   34    26 root     S      208   0%   1   0% {s6-ipcserverd} /package/admin/s6/
   19    16 root     S      204   0%   3   0% {s6-linux-init-s} /package/admin/s
Ubuntu-Laptop:/config#

There are no unusual integrations so is it a matter of bouncing the system every few weeks?

(I am not brilliant at Linux performance but a lifetime on VMS has given me a good background in diagnostics.)

Any help would be gratefully received as I love HA and the effort which has gone into it and the integrations.