Home Assistant Home Assistant out of memory issues Fixed

pete_c

Guru
Noticed recently here that HA #2 Virtual Box running on Ubuntu 22.04 host kept running of memory and rebooting itself.

memory.jpg

IE: would run up to 100% in less than an hour then reset itself. HA #1 running many add ons averages 8% utilization.

HA #2 Add ons used:

HACS==> Add ons

1 - Advanced SSH and Web terminal
2 - Mosquitto Broker
3 - Ring-MQTT with Video Streaming
4 - Studio Code Server
5 - Tasmo Admin
6 - Terminal and SSH

Settings ==> Integrations
1 -
Blitzortung Lightning Detector
2 - Broadlink
3 - DLNA Digital Media Renderer
4 - Dune HD
5 - HACS
6 - Home Assistant Supervisor
7 - Kodi
8 - Mobile App
9 - MQTT
10 - MyQ
11 - National Weather Service (NWS)
12 - Panasonic Viera
13 - Sun
14 - Tasmota

Plus 5 Amcrest PT cameras. Initially used ONVIF add on then switched it to manually adding RTSP cameras in configuration dot yaml file.

Database size was 2.5Gb. Deleted it and it went back to 2.5Gb in one day. Original build was 32Gb which was expanded to 64Gb.

Noticed that Blitzortung Lightning Detector add on was configured for entire US. Each lightning strike created one MQTT entity which filled up DB.
Reduced area to 5 miles.

Renamed file config==> .storage ==> homeassistant.exposed_entities to homeassistant.exposed_entities.old and restarted. (used sftp for this)

The homeassistant.exposed_entities file was 1.7 Gb. New file created is now 1.2kB and memory hovers around 7-8% which is similiar to HA box #1 with many addons running.
 
Last edited:
I wish Home Assistant would alert on unusual log & database growth, but I guess blowing up you database due to excessive logging is a right of passage!
 
Adding file size:

1 - add this to top of your configuration.yaml file.

Code:
homeassistant:
  allowlist_external_dirs:
    - "/config"

2 -
Browse to your Home Assistant instance.
Go to Settings > Devices & Services.
In the bottom right corner, select the Add Integration button.
From the list, select File Size.
Follow the instructions on screen to complete the setup.

DB-size.jpg
 
Last edited:
Good idea! That would allow you to detect unusual patterns with the statistics integration. Will have to play with that as I may have blown up my own database in the past.
 
Back
Top