Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

castero crashed and cleared database file #178

Open
ghost opened this issue Jul 11, 2021 · 4 comments
Open

castero crashed and cleared database file #178

ghost opened this issue Jul 11, 2021 · 4 comments

Comments

@ghost
Copy link

ghost commented Jul 11, 2021

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
Copy link
Owner

xgi commented Jul 11, 2021

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.

@ghost
Copy link
Author

ghost commented Jul 11, 2021

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
Copy link

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
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants