Something is preventing your database session from closing.
2024-07-06 04:34:40.785 WARNING (MainThread) [homeassistant.core] Timed out waiting for final writes to complete, the shutdown will continue
2024-07-06 04:34:40.785 WARNING (MainThread) [homeassistant.core] Shutdown stage 'final write': still running:
Would calling the purge service after a 2024.7.x update definitively prove whether or not my database is subject to this problem, or could it still happen later, at the 4 AM auto-purge?
Normally the manual purge should trigger the issue. Run the service, wait half an hour and then check the logs and your entity statistics and see if anything got stuck. That’s the procedure as far as I am aware.
I fit into the catagory who has none of the known problem integrations, but has the problem after the 2024.7.1 upgrade, not fixed with the 2024.7.2 update. So I rolled back to 2024.6.4 and the problem was fixed.
I will keep watching this space and not updated until there is some evidence the 2024.8 (or something else) fixes the issue. For me it was not an option to stay with 2024.7, as by then with lots of entities, the db size would have grown and filled the disk.
This thread was created to address issues caused by custom integrations that @tom_l has highlighted.
Separately, there’s an influx of people who have a separate (older) issue related to purge that will be addressed in 2024.8. That issue was not created by this release, it’s just more apparent with this release.
If you have issues related to purge, please check out the issue linked above. Otherwise, this is not the correct thread.
Just for clarity, why is the issue more apparent with this release? I have two installs, one old one that has been upgraded for years which has the DB issue, but the other (newer Install) has not.
Is it just more apparent because the history / recorder stalls in this release? What was the issue before?
There are some HA which start 2 or 3 years ago where the schema of the DB is involving. Like mine, starting in 2021 with schema version 23 where we are now in version 43. There was no issue till an update coming with 2024.7 of Alpine version that cause sqlite dependencies and locking of database.
It’s not core HA code change or sql code purge change.
For those old db, even with new schema, they still have some difference in table (index, keys) . I’m not a DBA but it’s what I understood.
So now migration script will have to recreate some tables to remove those parts which is no more used but remains. It’s a risky process and sqlite have define some steps (12) for that where thanks to @bdraco try to resolve.
Solution (you need to consider this for advanced users/own risk - backup and check to have enough free disk space of course !
It’s solve the issue on mine.
Hi,
I encountered (probably the 1st issue).
Is there a way to write an automation to get a notification (that part I know how to do) when the recorder stops working? (that part I don’t)…
D.
It’s more apparent because more people are hitting it. The bug existed long before this release but there wasn’t enough people/information to figure out what the problem was. Just take a look at the linked issue and you’ll get a history dating back before this release.