Recorder DB in RAM

Hello all,

I’ve just updated my HA installation and I can’t use anymore the string db_url: 'sqlite:////dev/shm/ha-recorder-v2.db' , probably there’s no more /dev/shm I don’t know. I remember that I’ve found this string here in the forums to keep the recorder DB in ram. There’s a way to do it again please?

1 Like

I have the exact same problem. Does anybody know any solution? This happened after OS update to 12.2 version.

It was removed as it was unstable and caused a lot of issues. I’m guessing 2024.4 finally removed the functionality altogether. You might still be able to do it with sqlite://:memory:. I’m not sure if this will work or not.

1 Like

Unstable how? This setup worked perfectly fine for me, never crashed. How can such an option be deprecated so easily and without proper prior notification?

Possibly for you, sure. But for others, since it wasn’t thread safe and HA has been moving more and more functionality to async, the option wasn’t viable for all users.

Pretty sure I remember a blog post about it being removed back in 2022/2023. So, 2 years ago-ish. I don’t see how that is “easily” and without proper prior notification. That post I linked was from May of 2022. Not sure that really constitutes as “without prior notification”.

Can someone please verify how and in what way was this exactly changed in 12.2? Can’t find anything in the release notes. I’m asking in order to try to find a solution.

It was removed in April of 2022.

I’m actually amazed it’s been working for you for this long. :man_shrugging:

[Edit] Actually, I do… you’ve been using the /dev/shm/ hack and that gets around the removal boolean.

Exactly. And it’s been working just fine until 12.2 OS update. But I can’t find what this NEW version changed in relation to this and where is that documented.

the :memory: was removed, no mentions for the /dev/shm/ in latest build but now seems not working.
Anyone have found a workaround? Maybe some other mount point?

I’ve found nothing in the release notes and online. Can’t understand why this solution is being chased like this. Give us the option and let us decide.
I’ve reverted back to OS 12.1 for now until someone proposes an actual solution.

1 Like

@bdraco was pretty clear about why. In memory sqlite3 databases are not thread safe and can cause issues. HA is moving more and more to a threaded, async platform. So, there’s more and more risk for the recorder to make the system unstable.

So no plans to get it back? I’ll need a new SD soon I think.

No. I highly doubt it will come back considering that it can cause instability.

You could go the SSD route which is both cheaper in the long run, highly supported in HA, provides a better experience too and can last for years. Or go with a high quality SD card as well and reduce writes by configuring recorder to only write the data you need.

I think you’re missing the point here. I was not using “:memory:” but writing in a RAM disk (or something, I’m not that expert). So writing on a SD or on a RAM disk I doubt that it can break something tbh.
Or probably I’m missing something.

Writing to a file, yeah, that’s standard and supported. Writing to a RAM drive, tbh, I’m not certain how sqlite3 handles that. Writing to an in-memory database wasn’t thread safe, so lots of things could go wrong there. Using a RAM disk should be just like using a standard file handle, but I’m not entirely certain.

I would suggest filing a bug on HA core’s github and explicitly state that /dev/shm isn’t working as it should be. It may likely be a bug OR the devs shadow removed /dev/shm for some reason. Either way, I think that’s the only way to get a real answer.