castero
castero copied to clipboard
castero crashed and cleared database file
I left castero running overnight and it crashed at some point. There were no error messages, and I needed to use reset
to get a working terminal again. Relaunching castero showed no podcasts, and ~/.local/share/castero/castero.db
as well as castero.db.old
contained only the following:
SQLite format 3@ .S`
\
\&tableprogressprogressCREATE TABLE progress (
ep_id integer primary key,
time integer,
FOREIGN KEY (ep_id) REFERENCES episode(id) ON DELETE CASCADE
)tablequeuequeueCREATE TABLE queue (
id integer primary key,
ep_id integer,
FOREIGN KEY (ep_id) REFERENCES episode(id) ON DELETE CASCADE
)StableepisodeepisodeCREATE TABLE episode (
id integer primary key,
feed_key text,
title text,
description text,
link text,
pubdate text,
copyright text,
enclosure text, played bit not null default 0,
FOREIGN KEY (feed_key) REFERENCES feed(key) ON DELETE CASCADE
)QtablefeedfeedCREATE TABLE feed (
key text primary key,
title text,
description text,
link text,
last_build_date text,
copyright text
)';indexsqlite_autoindex_feed_1feed
I'm sorry that happened.
My hypothesis for what happened is:
- whatever caused the crash (whether castero itself or something else) led to castero attempting to forcibly close
- while closing, castero tried to write its in-memory database to
castero.db
but was interrupted, causing incomplete/invalid data written - castero was re-opened, but it wasn't able to properly read anything from the database, so it appeared as empty
- closing castero would have caused the
castero.db
to be overwritten with the empty contents - if castero was restarted/closed again (?) then
castero.db.old
would have been written with the empty contents as well
I'm not sure what caused the corruption in the first place, but I can try to think of a better way to handle backups.
Also, although this is obviously unacceptable, you can enable the "restrict_memory_usage" setting which would make this class of problem impossible, since it does fs operations after every action rather than on close.
I will definitely enable that setting, thanks. I've also set up a cron job to make regular git backups of the database files in case something similar happens again. thanks.
I can say that I've experienced this issue when I my disk gets is full and I close castero. After that, when I opened it back, my client opened as if it was the first time.
I'd like to add that from my experience, this happens to me when I restart my computer ONLY. If I add a feed and exit the app then open the app again, the feeds are still there. The same thing happens if I close the terminal and open it back up and run castero, the feeds are still there.
However, with a reboot, the feeds never survive. I run Fedora 38, by the way, using KDE/Wayland