Memory leak Hass (Docker container version)

I think there is a memory leak. Below you find the memory usage reported based on the RAM report from Home Assistant.
I have disabled history on Raspberry Pi 3 (that is running Hass) and I’m pushing everything using InfluxDB connector on a that is running InfluxDB and Grafana.



I forgot to mention that I’m running 0.51.2 of Home Assistant software, and I’ve upgraded 3 times already using the built in upgrade method from Hass menu.

Anyone else experiencing anything similar? I don’t have many components enabled so should be fairly easy to compare.

Interesting! Could there be a link to the problems I’m experiencing with restarting? - see post in other topic.

I know this is an old thread, but I am experiencing this. I have the docker container running on my Synology and after about 8-9 days the memory usage grows from about 120MB at start (time = 0) to 650MB. It grows every day. Around the 7th day of uptime I notice performance issues especially with MQTT and ZWave where commands sent over those seem to either fail or be slow.

1 Like

We should open an issue on github

I didn’t see a current open GitHub issue, so I created one:

hey @ciotlosm do you by chance use the built in MQTT broker in HA? I used to and about 2 days ago switched over to using a Docker container version of Mosquitto MQTT broker and since then my memory usage of the HA Docker has only gone up marginally. The verdict is still out and I’ll give it a few more days, but I will say after switching to the external broker, the performance of MQTT in my system increased dramatically.

@squirtbrnr I have been using Mosquitto MQTT addon since the start. I’ve been monitoring this and memory still goes up.

I seem have the same problem, my container uses around 3Gb of memory after a few days, maybe a week. After the same period of time the CPU usage is higher as well and consumer 25%, which means 100% of one of my four cores on the Synology. I don’t think the Python process that uses the 25% can execute on more than one core.

When looking in the Resource monitor–>Task manager–>Processes I see a process called python at the top, using 25% of the CPU resources and this usage disappears when restarting HA.

I will ssh in next time and see if the htop command displays more info.

So I did a test last Friday and let HA run over the weekend. I turned off the built in MQTT broker and setup an external Mosquitto MQTT broker and pointed my HA docker to it. I let both run for 5 days and the memory usage never stayed above 250MB consumed. It did peak a few times up near 290MB, 350MB, and 400MB but went back down. I’m going to keep running an external MQTT broker, but I believe in my case, it was the built in MQTT broker that caused the memory leak.

Mine has been running for 8 hours and I’m showing 2.3GB ram use… External MQTT in another docker container.

I’m at 6.5 days of uptime and at 209MB RAM usage. I’ve seen it as low as 170MB and as high as 350MB. You most likely have something else causing your memory leak. Check the home assistant log, but also check the docker logs for errors and clues.

Not sure how to check the docker log. I executed the command: sudo docker logs -f home_assistant and I got a lot more than what is showing in the home assistant log. I’m going to assume this is going into the container log and might be the issue? If so, how do I stop it? What appeared seem to be a list of everything going on behind the scenes (MQTT updates, etc).

i still have the same issue even on 0.117 ( beta versions )

Hardware :
rasperry pi 3 b+ ( 1 Gb Ram ) Home Assistant supervised ( docker ) 0.116.4
debian buster with all possible updates

Home Assistant (running only with deconz ( conbee II ) + motioneye + few sensors )

aprox. after 20 hours of running
memory usage ram & swap suddenly rising until both are on 100 %

Result : homeassistant renders completeley unresponsive,
further investigation impossible - only solution : hard reboot ( power on/off ) :roll_eyes:
solid green led on raspberry :face_with_hand_over_mouth:

my solution ( workaround ? ) so far ( still testing ) :stuck_out_tongue_winking_eye:

i disabled the swap file ( tested 100 to 800 MB ) on my sd-card (dphys-swapfile stop )

and changed my swap partition to an 16 GB fast USB flash drive

now i can watch an interplay going on :

ram usage rises up to 80 % max.
then swap usage rises to ~ 500 - 600 MB ( 16G available )

then both values suddenly drop

ram to ~ 50 %
swap slowly to 400 - 500MB

i can see this going on in a “slow” loop :slight_smile:

Home Assistant is running really fast now - now more problems so far. :+1:

maybe it’s just an issue with my SD-Card being too slow ? ( swap writing )
( 32 GB SanDisc HC1 Class 10 ) ?

i will watch & report :slight_smile:

comments welcome


Hi. I have now exactly the same problem. I use raspberry pi 3 B, with HA 0.116.2 and HassOS 4.15.

I use following Addons:

  • Deconz with Conbee II Stick
  • Graphana
  • InfluxDB
  • Home Assistant Google Drive Backup (no update for long time)
  • Mosquitto Broker (no update for long time)
  • SSH & Web Terminal (no update for long time)
  • File Editor (no update for long time)

And I use HACS with Alexa Media Player for a very long time.

Yesterday my HA was not responsible. I have to reboot via the debug SSH (port 22222). My SSH Addon didnt work anymore. After reboot everything work fine. But swap still increases.


@macgyver50 @ottelo I had the same behaviour a while back.
The memory leak was because of the Mosquito Broker (not addon)
Switching to the addon solved that.
The best thing I did recently for stability is starting fresh, as my install was from 2 years back, updated along the way.
I started with a new image and clean configuration files etc, then followed all the updated documentation to add everything again.


thank you for your reply

i only use motioneye as Home Assistant Add-on
but deconz is installed in linux, an there i may have found the culprit :slight_smile:

i removed deconz completely from the linux-os and reinstalled via
Home Assistant as “real” addon.

memory usage now stabilizes around ~ 60 - 70 %
now i have to wait how it turns out during the next hours :stuck_out_tongue_winking_eye: