xgi / castero

TUI podcast client for the terminal
MIT License
608 stars 37 forks source link

castero crashed and cleared database file #178

Open ghost opened 3 years ago

ghost commented 3 years ago

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
xgi commented 3 years ago

I'm sorry that happened.

My hypothesis for what happened is:

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.

ghost commented 3 years ago

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.

ScriptForAll commented 2 years ago

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.

iamteedoh commented 1 year ago

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