I have a stable error with a DB. The issue is reproduced all the time on SQLite, MariaDB and now on PostgreSQL. I exclude almost all statistics from the config:
recorder:
db_url: !secret psql_string
db_retry_wait: 15
purge_keep_days: 90
commit_interval: 10
exclude:
domains:
- media_player
- switch
- automation
- update
- person
- binary_sensor
- sun
- zone
- camera
- device_tracker
- weather
- button
- light
- select
#- sensor
entity_globs:
- sensor.sun*
- sensor.weather_*
event_types:
- service_removed
- service_executed
- platform_discovered
- homeassistant_start
- homeassistant_stop
- feedreader
- service_registered
- call_service
- component_loaded
- logbook_entry
- system_log_event
- automation_triggered
- script_started
- timer_out_of_sync
- recorder_5min_statistics_generated
- recorder_hourly_statistics_generated
- panels_updated
- telegram_sent
- device_registry_updated
The error that cause global fault of HA. After this error, Supervisor is crashed and only a hard reset can fix the situation.
Logger: homeassistant.components.recorder.core
Source: components/recorder/core.py:912
Integration: Recorder (documentation, issues)
First occurred: 19:02:16 (1 occurrences)
Last logged: 19:02:16
SQLAlchemyError error processing task CommitTask(): This Session's transaction has been rolled back due to a previous exception during flush. To begin a new transaction with this Session, first issue Session.rollback(). Original exception was: (psycopg2.errors.IoError) could not read block 23 in file "base/16480/2608": I/O error [SQL: INSERT INTO state_attributes (hash, shared_attrs) SELECT p0::BIGINT, p1::TEXT FROM (VALUES (%(hash__0)s, %(shared_attrs__0)s, 0), (%(hash__1)s, %(shared_attrs__1)s, 1)) AS imp_sen(p0, p1, sen_counter) ORDER BY sen_counter RETURNING state_attributes.attributes_id, state_attributes.attributes_id AS attributes_id__1] [parameters: {'hash__0': 2994023477, 'shared_attrs__0': '{"state_class":"measurement","server_name":"Slobozhanske","server_country":"Ukraine","server_id":"39363","bytes_received":116196516,"unit_of_measurement":"Mbit/s","device_class":"data_rate","icon":"mdi:speedometer","friendly_name":"SpeedTest Download"}', 'hash__1': 3121778268, 'shared_attrs__1': '{"state_class":"measurement","server_name":"Slobozhanske","server_country":"Ukraine","server_id":"39363","bytes_sent":117121024,"unit_of_measurement":"Mbit/s","device_class":"data_rate","icon":"mdi:speedometer","friendly_name":"SpeedTest Upload"}'}] (Background on this error at: https://sqlalche.me/e/20/e3q8) (Background on this error at: https://sqlalche.me/e/20/7s2a)
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/recorder/core.py", line 912, in _process_one_task_or_recover
File "/usr/src/homeassistant/homeassistant/components/recorder/tasks.py", line 305, in run
File "/usr/src/homeassistant/homeassistant/components/recorder/core.py", line 1163, in _commit_event_session_or_retry
File "/usr/src/homeassistant/homeassistant/components/recorder/core.py", line 1183, in _commit_event_session
File "/usr/local/lib/python3.11/site-packages/sqlalchemy/orm/session.py", line 1969, in commit
File "<string>", line 2, in commit
File "/usr/local/lib/python3.11/site-packages/sqlalchemy/orm/state_changes.py", line 103, in _go
File "/usr/local/lib/python3.11/site-packages/sqlalchemy/orm/session.py", line 929, in _raise_for_prerequisite_state
sqlalchemy.exc.PendingRollbackError: This Session's transaction has been rolled back due to a previous exception during flush. To begin a new transaction with this Session, first issue Session.rollback(). Original exception was: (psycopg2.errors.IoError) could not read block 23 in file "base/16480/2608": I/O error
[SQL: INSERT INTO state_attributes (hash, shared_attrs) SELECT p0::BIGINT, p1::TEXT FROM (VALUES (%(hash__0)s, %(shared_attrs__0)s, 0), (%(hash__1)s, %(shared_attrs__1)s, 1)) AS imp_sen(p0, p1, sen_counter) ORDER BY sen_counter RETURNING state_attributes.attributes_id, state_attributes.attributes_id AS attributes_id__1]
[parameters: {'hash__0': 2994023477, 'shared_attrs__0': '{"state_class":"measurement","server_name":"Slobozhanske","server_country":"Ukraine","server_id":"39363","bytes_received":116196516,"unit_of_measurement":"Mbit/s","device_class":"data_rate","icon":"mdi:speedometer","friendly_name":"SpeedTest Download"}', 'hash__1': 3121778268, 'shared_attrs__1': '{"state_class":"measurement","server_name":"Slobozhanske","server_country":"Ukraine","server_id":"39363","bytes_sent":117121024,"unit_of_measurement":"Mbit/s","device_class":"data_rate","icon":"mdi:speedometer","friendly_name":"SpeedTest Upload"}'}]
(Background on this error at: https://sqlalche.me/e/20/e3q8) (Background on this error at: https://sqlalche.me/e/20/7s2a)