MariaDB Addon offline

I see since last week those errors:

2024-11-14 21:16:46.240 ERROR (Recorder) [homeassistant.components.recorder.util] Error executing query: (MySQLdb.OperationalError) (2002, "Can't connect to server on 'core-mariadb' (115)")
(Background on this error at: https://sqlalche.me/e/20/e3q8)
2024-11-14 21:16:46.343 ERROR (Recorder) [homeassistant.components.recorder.util] Error executing query: (MySQLdb.OperationalError) (2002, "Can't connect to server on 'core-mariadb' (115)")
(Background on this error at: https://sqlalche.me/e/20/e3q8)
2024-11-14 21:16:46.444 ERROR (Recorder) [homeassistant.components.recorder.util] Error executing query: (MySQLdb.OperationalError) (2002, "Can't connect to server on 'core-mariadb' (115)")
(Background on this error at: https://sqlalche.me/e/20/e3q8)
2024-11-14 21:16:46.444 ERROR (Recorder) [homeassistant.components.recorder.core] Unhandled database error while processing task <Event state_changed[L]: entity_id=sensor.energy_weekly, old_state=<state sensor.energy_weekly=411.128; state_class=total_increasing, status=collecting, last_period=846.467, last_valid_state=0.303, last_reset=2024-11-10T23:00:00.043272+00:00, next_reset=2024-11-18T00:00:00+01:00, unit_of_measurement=kW, device_class=power, friendly_name=Energy weekly @ 2024-11-14T21:16:39.414575+01:00>, new_state=<state sensor.energy_weekly=411.129; state_class=total_increasing, status=collecting, last_period=846.467, last_valid_state=0.304, last_reset=2024-11-10T23:00:00.043272+00:00, next_reset=2024-11-18T00:00:00+01:00, unit_of_measurement=kW, device_class=power, friendly_name=Energy weekly @ 2024-11-14T21:16:45.759222+01:00>>
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 146, in __init__
    self._dbapi_connection = engine.raw_connection()
                             ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 3300, in raw_connection
    return self.pool.connect()
           ^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/sqlalchemy/pool/base.py", line 449, in connect
    return _ConnectionFairy._checkout(self)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/sqlalchemy/pool/base.py", line 1263, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
  File "/usr/local/lib/python3.12/site-packages/sqlalchemy/util/langhelpers.py", line 146, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/usr/local/lib/python3.12/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
                       ^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/sqlalchemy/pool/base.py", line 837, in get_connection
    self.__connect()
  File "/usr/local/lib/python3.12/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
  File "/usr/local/lib/python3.12/site-packages/sqlalchemy/util/langhelpers.py", line 146, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/usr/local/lib/python3.12/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/create.py", line 643, in connect
    return dialect.connect(*cargs, **cparams)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/default.py", line 620, in connect
    return self.loaded_dbapi.connect(*cargs, **cparams)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/MySQLdb/__init__.py", line 121, in Connect
    return Connection(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/MySQLdb/connections.py", line 195, in __init__
    super().__init__(*args, **kwargs2)
MySQLdb.OperationalError: (2002, "Can't connect to server on 'core-mariadb' (115)")

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/recorder/core.py", line 874, in _process_one_task_or_event_or_recover
    self._process_one_event(task)
  File "/usr/src/homeassistant/homeassistant/components/recorder/core.py", line 1013, in _process_one_event
    self._process_state_changed_event_into_session(event)
  File "/usr/src/homeassistant/homeassistant/components/recorder/core.py", line 1108, in _process_state_changed_event_into_session
    elif metadata_id := states_meta_manager.get(entity_id, session, True):
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/recorder/table_managers/states_meta.py", line 63, in get
    return self.get_many((entity_id,), session, from_recorder)[entity_id]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/recorder/table_managers/states_meta.py", line 113, in get_many
    for metadata_id, entity_id in execute_stmt_lambda_element(
                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/recorder/util.py", line 195, in execute_stmt_lambda_element
    executed = session.execute(stmt)
               ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/sqlalchemy/orm/session.py", line 2351, in execute
    return self._execute_internal(
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/sqlalchemy/orm/session.py", line 2226, in _execute_internal
    conn = self._connection_for_bind(bind)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/sqlalchemy/orm/session.py", line 2095, in _connection_for_bind
    return trans._connection_for_bind(engine, execution_options)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<string>", line 2, in _connection_for_bind
  File "/usr/local/lib/python3.12/site-packages/sqlalchemy/orm/state_changes.py", line 139, in _go
    ret_value = fn(self, *arg, **kw)
                ^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/sqlalchemy/orm/session.py", line 1189, in _connection_for_bind
    conn = bind.connect()
           ^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 3276, in connect
    return self._connection_cls(self)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 148, in __init__
    Connection._handle_dbapi_exception_noconnection(
  File "/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 2440, in _handle_dbapi_exception_noconnection
    raise sqlalchemy_exception.with_traceback(exc_info[2]) from e
  File "/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 146, in __init__
    self._dbapi_connection = engine.raw_connection()
                             ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 3300, in raw_connection
    return self.pool.connect()
           ^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/sqlalchemy/pool/base.py", line 449, in connect
    return _ConnectionFairy._checkout(self)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/sqlalchemy/pool/base.py", line 1263, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
  File "/usr/local/lib/python3.12/site-packages/sqlalchemy/util/langhelpers.py", line 146, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/usr/local/lib/python3.12/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
                       ^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/sqlalchemy/pool/base.py", line 837, in get_connection
    self.__connect()
  File "/usr/local/lib/python3.12/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
  File "/usr/local/lib/python3.12/site-packages/sqlalchemy/util/langhelpers.py", line 146, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/usr/local/lib/python3.12/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/create.py", line 643, in connect
    return dialect.connect(*cargs, **cparams)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/default.py", line 620, in connect
    return self.loaded_dbapi.connect(*cargs, **cparams)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/MySQLdb/__init__.py", line 121, in Connect
    return Connection(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/MySQLdb/connections.py", line 195, in __init__
    super().__init__(*args, **kwargs2)
sqlalchemy.exc.OperationalError: (MySQLdb.OperationalError) (2002, "Can't connect to server on 'core-mariadb' (115)")
(Background on this error at: https://sqlalche.me/e/20/e3q8)
2024-11-14 21:16:46.450 ERROR (Recorder) [homeassistant.components.recorder.util] Error executing query: (MySQLdb.OperationalError) (2002, "Can't connect to server on 'core-mariadb' (115)")
(Background on this error at: https://sqlalche.me/e/20/e3q8)
2024-11-14 21:16:46.551 ERROR (Recorder) [homeassistant.components.recorder.util] Error executing query: (MySQLdb.OperationalError) (2002, "Can't connect to server on 'core-mariadb' (115)")
(Background on this error at: https://sqlalche.me/e/20/e3q8)
2024-11-14 21:16:46.654 ERROR (Recorder) [homeassistant.components.recorder.util] Error executing query: (MySQLdb.OperationalError) (2002, "Can't connect to server on 'core-mariadb' (115)")
(Background on this error at: https://sqlalche.me/e/20/e3q8)

Ans this part is the log of MariaDB itself:


2024-11-14 21:16:46 0 [Note] Starting MariaDB 10.11.6-MariaDB source revision fecd78b83785d5ae96f2c6ff340375be803cd299 as process 315

2024-11-14 21:16:46 0 [Note] InnoDB: Compressed tables use zlib 1.3.1

2024-11-14 21:16:46 0 [Note] InnoDB: Number of transaction pools: 1

2024-11-14 21:16:46 0 [Note] InnoDB: Using crc32 + pclmulqdq instructions

2024-11-14 21:16:46 0 [Note] mysqld: O_TMPFILE is not supported on /var/tmp (disabling future attempts)

2024-11-14 21:16:46 0 [Note] InnoDB: Using Linux native AIO

2024-11-14 21:16:46 0 [Note] InnoDB: Initializing buffer pool, total size = 128.000MiB, chunk size = 2.000MiB

2024-11-14 21:16:46 0 [Note] InnoDB: Completed initialization of buffer pool

2024-11-14 21:16:46 0 [Note] InnoDB: File system buffers for log disabled (block size=512 bytes)

2024-11-14 21:16:46 0 [Note] InnoDB: Starting crash recovery from checkpoint LSN=87699569535

2024-11-14 21:16:46 0 [Note] InnoDB: End of log at LSN=87734077411

2024-11-14 21:16:46 0 [Note] InnoDB: To recover: 1956 pages

2024-11-14 21:16:46 0 [Note] InnoDB: 128 rollback segments are active.

2024-11-14 21:16:46 0 [Note] InnoDB: Removed temporary tablespace data file: "./ibtmp1"

2024-11-14 21:16:46 0 [Note] InnoDB: Setting file './ibtmp1' size to 12.000MiB. Physically writing the file full; Please wait ...

2024-11-14 21:16:46 0 [Note] InnoDB: File './ibtmp1' size is now 12.000MiB.

2024-11-14 21:16:46 0 [Note] InnoDB: log sequence number 87734077411; transaction id 12117232

2024-11-14 21:16:46 0 [Note] InnoDB: Loading buffer pool(s) from /data/databases/ib_buffer_pool

2024-11-14 21:16:46 0 [Note] Plugin 'FEEDBACK' is disabled.

2024-11-14 21:16:46 0 [Note] InnoDB: Buffer pool(s) load completed at 241114 21:16:46

2024-11-14 21:16:46 0 [Note] Server socket created on IP: '0.0.0.0'.

2024-11-14 21:16:46 0 [Note] Server socket created on IP: '::'.

2024-11-14 21:16:46 0 [Note] mysqld: ready for connections.

Version: '10.11.6-MariaDB' socket: '/run/mysqld/mysqld.sock' port: 3306 Alpine Linux

Can someone tell how to solve this?
Only what work is restart MariaDB every time

HI poudenes,

Looks angry.
Either out of room, or corrupt, or something else bad.

Out of room on drive isn’t the issue:

overlay              122327520  17994680  99322764  15% /
/dev/sda8            122327520  17994680  99322764  15% /media
/dev/sda8            122327520  17994680  99322764  15% /data
devtmpfs               1948228         0   1948228   0% /dev
tmpfs                  1950472         0   1950472   0% /dev/shm
/dev/sda8            122327520  17994680  99322764  15% /addons
/dev/sda8            122327520  17994680  99322764  15% /ssl
/dev/sda8            122327520  17994680  99322764  15% /homeassistant
/dev/sda8            122327520  17994680  99322764  15% /backup
/dev/sda8            122327520  17994680  99322764  15% /addon_configs
/dev/sda8            122327520  17994680  99322764  15% /share
tmpfs                   780192      1556    778636   0% /run/docker.sock
tmpfs                  1950472         0   1950472   0% /dev/shm
tmpfs                   780192      1556    778636   0% /run/dbus
/dev/sda8            122327520  17994680  99322764  15% /run/audio
/dev/sda8            122327520  17994680  99322764  15% /etc/asound.conf
/dev/sda8            122327520  17994680  99322764  15% /etc/resolv.conf
/dev/sda8            122327520  17994680  99322764  15% /etc/hostname
/dev/sda8            122327520  17994680  99322764  15% /etc/hosts
tmpfs                   780192      1556    778636   0% /run/log/journal
/dev/sda8            122327520  17994680  99322764  15% /var/log/journal
/dev/sda8            122327520  17994680  99322764  15% /etc/pulse/client.conf
tmpfs                  1950472         0   1950472   0% /proc/asound
tmpfs                  1950472         0   1950472   0% /proc/acpi
devtmpfs               1948228         0   1948228   0% /proc/kcore
devtmpfs               1948228         0   1948228   0% /proc/keys
devtmpfs               1948228         0   1948228   0% /proc/timer_list
tmpfs                  1950472         0   1950472   0% /proc/scsi
tmpfs                  1950472         0   1950472   0% /sys/firmware

Maybe corrupt. Can be.

This is the log when I do a restart:

[08:19:33] INFO: Deleting service information from Home Assistant
s6-rc: info: service mariadb-post successfully stopped
s6-rc: info: service mariadb-core: stopping
2024-11-15  8:19:33 0 [Note] mysqld (initiated by: unknown): Normal shutdown
2024-11-15  8:19:33 0 [Note] InnoDB: FTS optimize thread exiting.
2024-11-15  8:19:33 0 [Note] InnoDB: Starting shutdown...
2024-11-15  8:19:33 0 [Note] InnoDB: Dumping buffer pool(s) to /data/databases/ib_buffer_pool
2024-11-15  8:19:33 0 [Note] InnoDB: Restricted to 2016 pages due to innodb_buf_pool_dump_pct=25
2024-11-15  8:19:33 0 [Note] InnoDB: Buffer pool(s) dump completed at 241115  8:19:33
2024-11-15  8:19:34 0 [Note] InnoDB: Removed temporary tablespace data file: "./ibtmp1"
2024-11-15  8:19:34 0 [Note] InnoDB: Shutdown completed; log sequence number 87802653373; transaction id 12132784
2024-11-15  8:19:34 0 [Note] mysqld: Shutdown complete
[08:19:34] INFO: Service mariadb exited with code 0 (by signal 0)
s6-rc: info: service mariadb-core successfully stopped
s6-rc: info: service mariadb-pre: stopping
s6-rc: info: service mariadb-pre successfully stopped
s6-rc: info: service legacy-cont-init: stopping
s6-rc: info: service legacy-cont-init successfully stopped
s6-rc: info: service fix-attrs: stopping
s6-rc: info: service fix-attrs successfully stopped
s6-rc: info: service s6rc-oneshot-runner: stopping
s6-rc: info: service s6rc-oneshot-runner successfully stopped
s6-rc: info: service s6rc-oneshot-runner: starting
s6-rc: info: service s6rc-oneshot-runner successfully started
s6-rc: info: service fix-attrs: starting
s6-rc: info: service fix-attrs successfully started
s6-rc: info: service legacy-cont-init: starting
s6-rc: info: service legacy-cont-init successfully started
s6-rc: info: service mariadb-pre: starting
[08:19:38] INFO: Using existing mariadb
s6-rc: info: service mariadb-pre successfully started
s6-rc: info: service mariadb-core: starting
s6-rc: info: service mariadb-core successfully started
s6-rc: info: service mariadb-post: starting
[08:19:38] INFO: Starting MariaDB
2024-11-15  8:19:38 0 [Note] Starting MariaDB 10.11.6-MariaDB source revision fecd78b83785d5ae96f2c6ff340375be803cd299 as process 67
2024-11-15  8:19:38 0 [Note] InnoDB: Compressed tables use zlib 1.3.1
2024-11-15  8:19:38 0 [Note] InnoDB: Number of transaction pools: 1
2024-11-15  8:19:38 0 [Note] InnoDB: Using crc32 + pclmulqdq instructions
2024-11-15  8:19:38 0 [Note] mysqld: O_TMPFILE is not supported on /var/tmp (disabling future attempts)
2024-11-15  8:19:38 0 [Note] InnoDB: Using Linux native AIO
2024-11-15  8:19:38 0 [Note] InnoDB: Initializing buffer pool, total size = 128.000MiB, chunk size = 2.000MiB
2024-11-15  8:19:38 0 [Note] InnoDB: Completed initialization of buffer pool
2024-11-15  8:19:38 0 [Note] InnoDB: File system buffers for log disabled (block size=512 bytes)
2024-11-15  8:19:38 0 [Note] InnoDB: End of log at LSN=87802653373
2024-11-15  8:19:38 0 [Note] InnoDB: 128 rollback segments are active.
2024-11-15  8:19:38 0 [Note] InnoDB: Setting file './ibtmp1' size to 12.000MiB. Physically writing the file full; Please wait ...
2024-11-15  8:19:38 0 [Note] InnoDB: File './ibtmp1' size is now 12.000MiB.
2024-11-15  8:19:38 0 [Note] InnoDB: log sequence number 87802653373; transaction id 12132785
2024-11-15  8:19:38 0 [Note] InnoDB: Loading buffer pool(s) from /data/databases/ib_buffer_pool
2024-11-15  8:19:38 0 [Note] Plugin 'FEEDBACK' is disabled.
2024-11-15  8:19:38 0 [Note] Server socket created on IP: '0.0.0.0'.
2024-11-15  8:19:38 0 [Note] Server socket created on IP: '::'.
2024-11-15  8:19:38 0 [Note] InnoDB: Buffer pool(s) load completed at 241115  8:19:38
2024-11-15  8:19:38 0 [Note] mysqld: ready for connections.
Version: '10.11.6-MariaDB'  socket: '/run/mysqld/mysqld.sock'  port: 3306  Alpine Linux
[08:19:39] INFO: MariaDB started
[08:19:39] INFO: Check data integrity and fix corruptions
mysql.column_stats                                 OK
mysql.columns_priv                                 OK
mysql.db                                           OK
mysql.event                                        OK
mysql.func                                         OK
mysql.global_priv                                  OK
mysql.gtid_slave_pos                               OK
mysql.help_category                                OK
mysql.help_keyword                                 OK
mysql.help_relation                                OK
mysql.help_topic                                   OK
mysql.index_stats                                  OK
mysql.innodb_index_stats                           OK
mysql.innodb_table_stats                           OK
mysql.plugin                                       OK
mysql.proc                                         OK
mysql.procs_priv                                   OK
mysql.proxies_priv                                 OK
mysql.roles_mapping                                OK
mysql.servers                                      OK
mysql.table_stats                                  OK
mysql.tables_priv                                  OK
mysql.time_zone                                    OK
mysql.time_zone_leap_second                        OK
mysql.time_zone_name                               OK
mysql.time_zone_transition                         OK
mysql.time_zone_transition_type                    OK
mysql.transaction_registry                         OK
homeassistant.event_data                           OK
homeassistant.event_types                          OK
homeassistant.events                               OK
homeassistant.migration_changes                    OK
homeassistant.recorder_runs                        OK
homeassistant.schema_changes                       OK
homeassistant.state_attributes                     OK
homeassistant.states                               OK
homeassistant.states_meta                          OK
homeassistant.statistics                           OK
homeassistant.statistics_meta                      OK
homeassistant.statistics_runs                      OK
homeassistant.statistics_short_term                OK
sys.sys_config                                     OK
[08:19:39] INFO: Ensuring internal database upgrades are performed
[08:19:39] INFO: Ensure databases exists
[08:19:39] INFO: Create database homeassistant
[08:19:39] INFO: Ensure users exists and are updated
[08:19:40] INFO: Update user mariadb
[08:19:40] INFO: Init/Update rights
[08:19:40] INFO: Granting all privileges to mariadb on homeassistant
[08:19:40] 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