gcgarner / IOTstack

docker stack for getting started on IOT on the Raspberry PI
GNU General Public License v3.0
1.51k stars 584 forks source link

Home Assistant container uses too much memory (RAM) #147

Open DIYtechie opened 4 years ago

DIYtechie commented 4 years ago

Thank you for making IOTstack! By far the easiest way to get started with docker.

Unfortunately, when I install Home Assistant from the IOTstack menu, I can only run very few and tiny containers on my Raspberry Pi 3B+ before the whole system becomes unresponsive and all services stop working. Please help me avoid this.

DIYtechie commented 4 years ago

More details and an idea for a potential solution:

I have Mosquitto, Node-RED, deconz and Homebridge currently using about 500 mb of RAM in total, which is ok. But when I install Home Assistant, is slowly starts eating up the rest of the available RAM, making the Rpi block and stop working. After a reboot, the Home Assistant container only uses about 100 mb ram (which is ok) but then slowly start eating away again.

One solution may be container resource constraints (limiting memory usage for a specific container): Docker provides ways to control how much memory (or CPU) a container can use, so I was thinking that it would make sense to be able to set a limit of e.g. 200 mb for HA (or any other container), so I can still use other containers as well, without excessive swapping. https://docs.docker.com/config/containers/resource_constraints/

If this is not feasible or a good idea, I'm very open to other ways of ensuring that Home Assistant does not bring the whole system to a standstill.

I don't know if this is a related issue, but even though I installed Home Assistant from the IOTstack menu, I cannot stop or even kill the hassio_supervisor container (regardless of whether I use docker commands or portainer). It resurrects immediately, effectively ignoring all sudo reboot or sudo poweroff commands. I tried a total wipe and reinstall 3 times with the same result.

DIYtechie commented 4 years ago

Perhaps the solution is to change the default log-options: https://community.home-assistant.io/t/solved-moved-over-to-docker-all-well-except-huge-memory-leak/49716/21?u=diy-techie