PSA: 2024.7 recorder problems

Final, Final Edit: If the system runs out of disk space, and the table rebuild fails, it will try again in 2024.8.1 or later see Recorder still locking up even after update to 2024.8.0 · Issue #123348 · home-assistant/core · GitHub Ensure legacy event foreign key is removed from the states table when a previous rebuild failed by bdraco · Pull Request #123388 · home-assistant/core · GitHub

Final Edit: The Home Assistant core-2024.7.2 release fixes or prevents both issues. Please update.

There are two issues that may affect your recorder in this release.

ISSUE 1:

If your recorder is stopping every morning at a bit past 4am, it is this issue: Purge causes recorder to stop writing to the DB until HA is restarted (Auto purge happens at 4:12am) · Issue #117263 · home-assistant/core · GitHub the fix for this will be released in version 2024.8 hopefully be released in a patch soon, until then disable recorder auto purging:

configuration.yaml

recorder:
  auto_purge: false

ISSUE 2:

These third party integrations (and posibly others) may prevent your recorder database from working correctly when running core release 2024.7.x

icloud3
places - EDIT: issue is fixed upgrade this
hass-variables - EDIT: issue is fixed upgrade this

They filter the database in an way they should not. See: 2024.7: Time to resize your cards! - #84 by Snuffy2

As this has generated an architecture discussion about providing a way to filter the recorder database safely it may not be a quick fix. Your current options are:

  1. Stay on 2024.7 but make sure to upgrade your 3rd party integrations if the issues are resolved in them, or
  2. Downgrade to the last HA core version (2024.6.4) and wait for a fix, or
  3. Stay on 2024.7 but stop using the offending 3rd party integration(s).
16 Likes
8 Likes

Thanks both of you for the heads-up!

I noticed a trend in the release notes thread which seemed to point at Recorder issues. Nice to have specifics so we know whether or not this impacts us.

Aha, that explains why my recorder is borked. I am running places. Weird thing is that there are no meaningful messages in the logs when this happens.

1 Like

hi there! care to elaborate on the symptoms? since upgrading, recorder stops working every night right after 4am. haven’t been able to find any meaningful log entry. it resumes after a restart, when i see a log entry saying “The system could not validate that the sqlite3 database at //config/home-assistant_v2.db was shutdown cleanly”. is this behavior consistent with the culprit integrations you mention or should i keep digging further? i am using hass-variables, just updated it to the supposedly fixed version, will see tomorrow morning if this was the issue. thanks!

5 Likes

Same here, every night just after four in the morning the recorder stops. I have the same error message about sqlite when restarting HA to get it running again.

I don’t have any of the above mentioned integrations but a few others.

4 Likes

as a workaround, you can configure your recorder to not auto_purge.
To do this, edit your configuration.yaml:

recorder:
  auto_purge: false

this should fix the issue for now - BUT: keep in mind to remove this change when a fix has been applied, else, your recorder will grow and that will cause other issues long term.

@silfax - same recommendation for you.

4 Likes

Does anyone know where the issue actually stems from? It seems like the recorder is “pausing” overnight, but that seems like a very strange kind of bug.

Have u read the first message in this thread?

yes, it is known.
in some cases it is related to some custom components.
in other cases it is related to an issue with the database - where an faulty index is causing a full tablescan → therefore, the db is in a locked state.

second issue will be fixed but requries some heavy database actions and therefore, can probably not be rolled out with a patch-release.

I have the exact same issue. Not using any of the mentioned integrations either. It’s been like this since upgrade to 2024.7 :confused:

4 Likes

Yeah, I also don’t have any of the potentially problematic integrations…and never had any trouble with the Database either…
Somehow the 2024.7 release seems to have more issues than usual. My HA Server seems to get “stuck” at 30% CPU usage regularly since I updated for some reason. RAM useage is also unusually high…

Just checked the logs and there seems to be some serious trouble with the “recorder”. It is running out of memory and CPU time and has now stopped completely. My “Helpers” like utility meters are apparently also affected…this is not good…

3 Likes

had the same problem with the EnergyDashboard as many here. For me it was definitely iCloud3. After importing backups a few times, I uninstalled iCloud3. Then the update and the Energy Dashboard worked without any problems.

1 Like

iCloud probably triggers it earlier, but I doubt removing it will solve the underlying issue. From what I understand, the recorder “purge” isn’t working and hangs, and that causes anything that relies on the Recorder to break down.

Nope, custom integrations like icloud and other integrations are incorrectly applying recorder filters, which is causing recorder to break down.

Is that definite? Because I don’t think I have any of the “offending” integrations and my recorder breaks reliably at 04:00 AM no matter what I do? Restarting HA fixes it until the next time 04:00 rolls through and deactivating the scheduled Purge seems to fix things for those affected (can’t verify myself, because I only enabled the workaround today and have to wait for the next 04:00 AM time window).

Yes, this is definite. Look in your logs for errors, post them here. The first post mentions that we don’t know all integrations that are causing the problem.

1 Like

Logger: homeassistant.components.recorder.util
Quelle: components/recorder/util.py:610
Integration: Recorder (Dokumentation, Probleme)
Erstmals aufgetreten: 14:08:00 (1 Vorkommnisse)
Zuletzt protokolliert: 14:08:00

Ended unfinished session (id=688 from 2024-07-05 18:29:01.716302)

Logger: homeassistant.components.recorder.util
Quelle: components/recorder/util.py:331
Integration: Recorder (Dokumentation, Probleme)
Erstmals aufgetreten: 14:07:59 (1 Vorkommnisse)
Zuletzt protokolliert: 14:07:59

The system could not validate that the sqlite3 database at //config/home-assistant_v2.db was shutdown cleanly

Those are relevant to the Recorder. Before the latest reboot I had more, mostly telling me that the Recorder queue is full and thus nothing new can be added by the Recorder. The issue tracker on GitHub shows pretty much the same and the general advice is to deactivate the “purge” as that works as a stopgap for now while the database/recorder purge issue has been fixed.

Can you please post the full stack trace from the text logs, not the ui. The previous log is also stored in home-assistant.log.1