The recorder backlog queue reached the maximum size of 40000 events

Today my recorder stopped working and found this error in the log

The recorder backlog queue reached the maximum size of 40000 events; usually, the system is CPU bound, I/O bound, or the database is corrupt due to a disk problem; The recorder will stop recording events to avoid running out of memory

It started working normally after a reboot, but it stopped working again after a few hours later, with the same error

I run HA on a Raspberry PI4

Home Assistant Core

Installed version

2022.5.3

Home Assistant Operating System

Installed version

7.6

Your system is really old and there have been several optimizations to the database system.
It is hard to predict how such a system behave today, especially if you have installed or upgraded integrations and addons the last 6 months or so.

I stopped updating as almost with every update I was required to manually change part of the configuration and/or something was crashing
I finally found a stable version about ago and refused to update ever since; I don’t need any of the new features (whatever they are)
This worked fine till yesterday!

Well, one of the optimization is the change in how data is written to the database.
The newer versions reuse entries, which limits the writes and the amount written.
This is especially good for those running on SDcards, because the wear down fast with the old method, which cause read/write errors and thereby also database corruption.