High memory usage, High load and constant reboots

Hello.

Recently I have been experiencing instability in m home assistant instance.
At first I thought it was some problems with some devices, but thankfully I have an alexa notification every time the server reboots, and that made me check the logs. I’m getting a reboot almost daily. Usually because memory usage is too high.

I have been checking the logs trying to find a guilty thing, but I don’t find anything specific.
I checked glances for some time, and I see that it has high load and high swap:

NOthing appears to be too crazy in memory usage:

Not sure if I should attach the full logs, let me know if it is safe.

In any case, here is a portion:

2025-12-05 07:12:09.113 homeassistant kernel: oom-kill:constraint=CONSTRAINT_NONE,nodemask=(null),cpuset=docker-4ec191ad171cef3a165d8af18dfd96b4b58d3e73ea74b41a3804879ed6405855.scope,mems_allowed=0,global_oom,task_memcg=/system.slice/docker-0f0e3220995936aa68598418cdda8528621d91cb35cb88bc158ff06baf1870b1.scope,task=dotnet,pid=374860,uid=0
2025-12-05 07:12:09.113 homeassistant kernel: Out of memory: Killed process 374860 (dotnet) total-vm:10927356kB, anon-rss:15360kB, file-rss:140kB, shmem-rss:0kB, UID:0 pgtables:516kB oom_score_adj:200
2025-12-05 07:12:09.113 homeassistant systemd-resolved[377]: Under memory pressure, flushing caches.
2025-12-05 07:12:09.114 homeassistant systemd-resolved[377]: Flushed all caches.
2025-12-05 07:12:09.114 homeassistant systemd[1]: docker-94e37f55d3d1524a367267b484f9ceab06a616b3b9f09441a7f209572e4b01b4.scope: A process of this unit has been killed by the OOM killer.
2025-12-05 07:12:09.114 homeassistant systemd-journald[101]: Under memory pressure, flushing caches.
2025-12-05 07:12:09.114 homeassistant systemd[1]: docker-94e37f55d3d1524a367267b484f9ceab06a616b3b9f09441a7f209572e4b01b4.scope: Deactivated successfully.
2025-12-05 07:12:09.114 homeassistant systemd[1]: docker-94e37f55d3d1524a367267b484f9ceab06a616b3b9f09441a7f209572e4b01b4.scope: Consumed 37.659s CPU time, 174.2M memory peak, 61.3M memory swap peak, 262.3M read from disk, 11.9M written to disk.
2025-12-05 07:12:09.116 homeassistant systemd-resolved[377]: Under memory pressure, flushing caches.
2025-12-05 07:12:09.118 homeassistant systemd-resolved[377]: Flushed all caches.
2025-12-05 07:12:09.118 homeassistant systemd-resolved[377]: Under memory pressure, flushing caches.
2025-12-05 07:12:09.118 homeassistant systemd-resolved[377]: Flushed all caches.
2025-12-05 07:12:09.118 homeassistant systemd[1]: docker-0f0e3220995936aa68598418cdda8528621d91cb35cb88bc158ff06baf1870b1.scope: A process of this unit has been killed by the OOM killer.
2025-12-05 07:12:09.118 homeassistant systemd[1]: docker-0f0e3220995936aa68598418cdda8528621d91cb35cb88bc158ff06baf1870b1.scope: Deactivated successfully.
2025-12-05 07:12:09.118 homeassistant systemd[1]: docker-0f0e3220995936aa68598418cdda8528621d91cb35cb88bc158ff06baf1870b1.scope: Consumed 15.214s CPU time, 99.8M memory peak, 61.2M memory swap peak, 976.5M read from disk.
2025-12-05 07:12:12.757 homeassistant kernel: appdaemon invoked oom-killer: gfp_mask=0x140cca(GFP_HIGHUSER_MOVABLE|__GFP_COMP), order=0, oom_score_adj=200
2025-12-05 07:12:12.813 homeassistant kernel: CPU: 0 UID: 0 PID: 381819 Comm: appdaemon Not tainted 6.12.51-haos #1
2025-12-05 07:12:12.813 homeassistant kernel: Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 4.2025.02-4~bpo12+1 07/10/2025
2025-12-05 07:12:12.813 homeassistant kernel: Call Trace:
2025-12-05 07:12:12.814 homeassistant kernel:  <TASK>
2025-12-05 07:12:12.814 homeassistant kernel:  dump_stack_lvl+0x64/0x80
2025-12-05 07:12:12.827 homeassistant kernel:  dump_header+0x3f/0x1a0
2025-12-05 07:12:12.828 homeassistant kernel:  oom_kill_process+0xf5/0x200
2025-12-05 07:12:12.828 homeassistant kernel:  out_of_memory+0x243/0x580
2025-12-05 07:12:12.828 homeassistant kernel:  __alloc_pages_noprof+0xf59/0x10f0
2025-12-05 07:12:12.906 homeassistant kernel:  alloc_pages_mpol_noprof+0x47/0xf0
2025-12-05 07:12:12.906 homeassistant kernel:  folio_alloc_noprof+0x56/0x90
2025-12-05 07:12:12.906 homeassistant kernel:  __filemap_get_folio+0xc6/0x240
2025-12-05 07:12:12.906 homeassistant kernel:  filemap_fault+0x14d/0xc50
2025-12-05 07:12:12.920 homeassistant kernel:  __do_fault+0x2c/0xb0
2025-12-05 07:12:12.920 homeassistant kernel:  __handle_mm_fault+0x652/0xba0
2025-12-05 07:12:12.920 homeassistant kernel:  handle_mm_fault+0x17a/0x2d0
2025-12-05 07:12:12.925 homeassistant kernel:  do_user_addr_fault+0x177/0x620
2025-12-05 07:12:12.925 homeassistant kernel:  exc_page_fault+0x71/0x150
2025-12-05 07:12:12.925 homeassistant kernel:  asm_exc_page_fault+0x26/0x30
2025-12-05 07:12:12.925 homeassistant kernel: RIP: 0033:0x7fc63967a230
2025-12-05 07:12:12.925 homeassistant kernel: Code: Unable to access opcode bytes at 0x7fc63967a206.
2025-12-05 07:12:12.925 homeassistant kernel: RSP: 002b:00007ffc406aef58 EFLAGS: 00010246
2025-12-05 07:12:12.930 homeassistant kernel: RAX: 00007fc639aacf80 RBX: 00007fc639b953c8 RCX: 00007ffc406aeff0
2025-12-05 07:12:12.930 homeassistant kernel: RDX: 96c5c404891e28cc RSI: 00007fc639b953c8 RDI: 00007fc6392b6600
2025-12-05 07:12:12.930 homeassistant kernel: RBP: 00007fc6383e2400 R08: 00007fc63937daf0 R09: 96c5c404891e28cc
2025-12-05 07:12:12.937 homeassistant kernel: R10: 00007fc638decb8e R11: 0000000000000001 R12: 00007fc6383e2400
2025-12-05 07:12:12.937 homeassistant kernel: R13: 00007ffc406aeff0 R14: 0000000000000001 R15: 00007fc6392b6600
2025-12-05 07:12:12.937 homeassistant kernel:  </TASK>
2025-12-05 07:12:12.937 homeassistant kernel: Mem-Info:
2025-12-05 07:12:12.937 homeassistant kernel: active_anon:517534 inactive_anon:306895 isolated_anon:0

Go through the time honored tradition of disabling all your addons and slowly over time seeing how they affect memory as you restart them.

Is there a way to disable them all?
I remember seeing a guide somewhere, but I can’t find it anymore

Like safe mode?

Memory capacity requirements can be fickle. Allowing for plenty of headroom is prudent. High swap rates confirm that. Be aware RAM prices have shot up recently, but consider if a memory stick or two to upgrade your computer is worth it.

Does this happen at around the same time every day, such as when housekeeping tasks kick in, or the sun rises and solar panel software wakes up? When the kettle goes on and you have a huge power surge? Do you possess a crucifix?

If you have vsCode add-on running, that might take over 1GB alone, so watch out for that one for sure.

2 Likes

Cameras seem to be sucking up alot of resources.

That is not yet a problem, because the VM is not using all the memory the device has.

Good question. I think it does not, but with how short is the storage of logs I can’t confirm this long term.

NO, I don’t. Should I get one?

I do have it, but I had it for years, probably one of the first ones I installed in HA, and never had a problem before.

I have a view with all my cameras and I use that quite often. I also have two wall panels that show area cards with the camera image as miniature.
Can that be the cause? Is there a way to make this work better?

I have now around ~11 cameras

If you only start it when you are using it, then stop it, you are OK. While using it it takes a lot. Experiment you will see.
Cameras are more bandwidth as opposed to memory.
2gb of memory and the seemingly inability to upgrade that (or you would not have had this question) lets me thing some kind of pi based server. 11 cameras as well.
Just get a Nuc or a Beelink or something with enough power to run those cameras and you will be set.

Working for years, fine. HA has doubled in size and complexity in years, and the amount of add-ons, integrations, and cameras you are using have more than doubled it that time as well. Time for the server to upgrade as well.

Does it start automatically or I need to go to integrations and then activate it? If it is the former, I can give that a try.

Why do you think it only has 2gb of memory? Because the glances screenshot? That screenshot is probably not showing all the ram accurately. It is a VM in a nuc within proxmox, and it has 4gb of ram available and very low CPU usage:

I think those should be plenty of resources for HA.

Even with the ability to upgrade I’m not the kind of person that just throws more resources at a problem and hopes for the best. I first want to understand what is the root cause of the problem, and if the problem is really lack of resources, then sure I should add more resources. But if there is something else adding more ram will probably just make the problem seem more random or take weeks instead of days to happen.

I appreciate your help, but I think my server is currently capable enough.
Once I figure out the root cause of the problem, maybe I will have to upgrade it anyway, but then it will be easier to decide if it needs 1 more GB, 512 MB or 1.5GB.

1 Like

In the add-on there is a selector to start auto or start it when you want it.
Yes if you have a VM then OK. I read this stuff and saw a PI4 2gb in my head. Sorry about that.


I have a couple of 8gb sticks in mine so I don’t care and leave it run.

So right now I got a couple of reboots in a row.
Not sure what may be happening, but I see a weird pattern of load increasing, swap increasing and memory use decreasing? This doesn’t make any sense:

Here is a portion of the logs of the most recent crash: