Frequent database issues

Am running homeassistant supervised on Debian (now already for several years). I use the standard MariaDB as database and this setup has been running very well since a long time. I do have to admit that I run quite a heavy installation with over a 1.000 sensors, but am running it on a pretty decent NUC i3 with 32 gigabytes of memory…

Since recently I am starting to experience issues (especially after updates). If I connect to the database with phpMyAdmin everything looks fine. I also tried the usual (restarting addons, restarting homeassistant, restarting host) but I have not yet found a solution to the problem (except rolling back a backup which solves it until the next upgrade).

Can anyone point me into the right direction to solving this issue?

The relevant log entries:

Supervisor:
2024-06-10 15:30:12.976 ERROR (MainThread) [supervisor.homeassistant.core] No Home Assistant Core response, assuming a fatal startup error

Homeassistant log:

2024-06-10 15:27:28.227 WARNING (MainThread) [homeassistant.setup] Setup of recorder is taking over 10 seconds.
2024-06-10 15:28:17.586 WARNING (MainThread) [homeassistant.bootstrap] Waiting on integrations to complete setup: {('recorder', None): 628.777099981}
2024-06-10 15:29:17.662 WARNING (MainThread) [homeassistant.bootstrap] Waiting on integrations to complete setup: {('recorder', None): 628.777099981}
2024-06-10 15:30:17.739 WARNING (MainThread) [homeassistant.bootstrap] Waiting on integrations to complete setup: {('recorder', None): 628.777099981}
2024-06-10 15:31:17.812 WARNING (MainThread) [homeassistant.bootstrap] Waiting on integrations to complete setup: {('recorder', None): 628.777099981}
2024-06-10 15:32:17.891 WARNING (MainThread) [homeassistant.bootstrap] Waiting on integrations to complete setup: {('recorder', None): 628.777099981}
2024-06-10 15:32:18.227 ERROR (MainThread) [homeassistant.setup] Setup of 'recorder' is taking longer than 300 seconds. Startup will proceed without waiting any longer
2024-06-10 15:32:19.589 ERROR (MainThread) [homeassistant.setup] Unable to set up dependencies of 'history_stats'. Setup failed for dependencies: ['recorder']
2024-06-10 15:32:19.590 ERROR (MainThread) [homeassistant.setup] Unable to prepare setup for platform 'history_stats.sensor': Could not setup dependencies: recorder
2024-06-10 15:32:19.590 ERROR (MainThread) [homeassistant.setup] Unable to set up dependencies of 'history_stats'. Setup failed for dependencies: ['recorder']
2024-06-10 15:32:19.590 ERROR (MainThread) [homeassistant.setup] Unable to prepare setup for platform 'history_stats.sensor': Could not setup dependencies: recorder
2024-06-10 15:32:19.590 ERROR (MainThread) [homeassistant.setup] Unable to set up dependencies of 'history_stats'. Setup failed for dependencies: ['recorder']
2024-06-10 15:32:19.591 ERROR (MainThread) [homeassistant.setup] Unable to prepare setup for platform 'history_stats.sensor': Could not setup dependencies: recorder
2024-06-10 15:32:19.591 ERROR (MainThread) [homeassistant.setup] Unable to set up dependencies of 'history_stats'. Setup failed for dependencies: ['recorder']
2024-06-10 15:32:19.591 ERROR (MainThread) [homeassistant.setup] Unable to prepare setup for platform 'history_stats.sensor': Could not setup dependencies: recorder
2024-06-10 15:32:19.591 ERROR (MainThread) [homeassistant.setup] Unable to set up dependencies of 'history_stats'. Setup failed for dependencies: ['recorder']
2024-06-10 15:32:19.591 ERROR (MainThread) [homeassistant.setup] Unable to prepare setup for platform 'history_stats.sensor': Could not setup dependencies: recorder

MariaDB log:

[15:21:13] INFO: Ensuring internal database upgrades are performed
[15:21:13] INFO: Ensure databases exists
[15:21:13] INFO: Create database homeassistant
[15:21:13] INFO: Ensure users exists and are updated
[15:21:13] INFO: Update user homeassistant
[15:21:13] INFO: Init/Update rights
[15:21:13] INFO: Granting all privileges to homeassistant on homeassistant
[15:21:14] INFO: Sending service information to Home Assistant

s6-rc: info: service mariadb-post successfully started
s6-rc: info: service legacy-services: starting
s6-rc: info: service legacy-services successfully started

Hello.

Did you sorted this out?
Same problem here. :frowning:

Not yet: I decided to move to socket connection and that solved it for now. Before doing so I ran a full check on the database that didn’t show any problems, so I guess the issue is elsewhere.

For now it is running at least :smile:

Coul you please tell me how to perform those two tasks?

Checking for errors can be done by installing the phpmyadmin addon. In there you can select the database and check for errors.

Moving to socket connection can be done by changing the recorder url in configuration.yaml to the following:

mysql://user:password@localhost/DB_NAME?unix_socket=/var/run/mysqld/mysqld.sock&charset=utf8mb4

Instead of localhost I have used core-mariadb as host.

1 Like

Thank you. I’ll do that. :+1: