Hi,
I am running HA on a Pi3B+, but noticed that after 6 days the module hangs.
Ping works fine, HA is unreachable, but SSH after a couple of tries works although with a huge delay.
Noticed also that RAM usage increase by around 2% daily and after 6 days it exceeds 90%, which might be the problem, but I am not sure.
It is a good idea to make a script to restart the Pi every 5 days or I might encounter new problems?
You âcouldâ try disabling them one at a time to see which one may be causing the issue.
Other that that, I suppose you have no option but to schedule a reboot.
Seems a bit clunky though.
Depending on your setup it will eventually start using more memory, in my case I had the same behavior it will start increasing until it passes 90% then somewhere after 90% it frees up memory and it went back to 60-70%. Sometimes it used to hang or slow quite a bit, a restart solved my issues, same as you.
At the end I actually just did a cleanup of all the stuff I donât actually need or use, so I did a pretty good cleanup of automations, scripts, addons and optimized the way in which I implemented all my devices. And while I was doing that I started commenting and nicely organizing my code.
The one thing that helped the most is filtering the entities on the recorder. Do NOT record stuff you donât actually need to record stuff you donât need like weather, switches, lights, devices that you donât track and specially those devices whose value changes very often.
The Raspberry Pi 3 B+ is definitely not a device to run tons of stuff but in your case I donât see what could be eating so many resources aside from having a ton of devices and recording the data for all of them. Try to purge your database as often as possible too.
I used to run on pi3 (now on pi4) and I noticed a gradual memory usage increase the moment I switched from sqlite to mariadb. Over the course of a week or so you could see a trend of mem usage going up. It didnât drop down again and kept creeping closer to 100% at which point you get the same issues you are seeing. I used to have a cronjob that reboots the pi every couple of days or at least restarts the docker containers.
thanks all of you for the input!
I record only required info that I would need to use in my automations and keep data in the MariaDB for just 4 days.
Currently I am trying to purge to electricity consumption usage stored in InfluxDB but that is work in progress
Good to know is that if you have a purging strategy of letâs say every 5 days, and you reboot within those 5 days every time, the data will never be purged.
It is a good idea to make a script to restart the Pi every 5 days or I might encounter new problems?
You need to fix the disease, not the symptoms. Try and monitor your RAM usage, and use the âhtopâ command in order to see what things are using up your RAM.
I may be running the 4GB Rpi 4, but so far I have 24 days uptime, and RAM usage does not increase over time.
I would start at an OS level. Just look into system monitoring programs for the OS you are running HA on, it should have some built in tools, for example:
âTask Managerâ on Windows
âActivity Monitorâ on MacOS
âhtopâ and âtopâ on many flavours of Linux, including Raspian which is what I use.
Just see what process is eating up your RAM and then look into why it is doing so. I did have this issue a while back with a 3rd party node on NodeRED, and as soon as I uninstalled the node, NodeRED memory usage stays below 300Mb most of the time, but with the memory leak it would use 500+Mb after 12 hours.
You may want to swap your boot SD card. Bad read / writes can cause many different kinds of problems ⌠Besides it wouldnât hurt to back up your system anyway before you go messing around with the software.
Sorry, my reference assumed you were running HassIO on HassOS, which is more of an appliance docker environment. You can check out this post for some options that may help either spotcheck or track the resource usage of the various containers.
I had the same issue 1/2 weeks ago so Iâve stopped using node-red.
I can confirm.
Had CPU spikes to 100% on my RPI4 with node-red active running only a simple ping automation. After disabling node everything is fine again and usage is under 5%