GNOME Bugzilla – Bug 621057
Should detect fatal database (corruption; sqlite db malformed) errors and prompt for recovery (from a backup?)
Last modified: 2020-03-17 08:58:55 UTC
Originally from https://bugs.launchpad.net/ubuntu/+source/banshee/+bug/582743, Banshee crashes with a malformed sqlite image when trying to move to the next title in any given music source. The stack trace is as follows: Unhandled Exception: Mono.Data.Sqlite.SqliteException: The database disk image is malformed database disk image is malformed at Mono.Data.Sqlite.Sqlite3.Reset (Mono.Data.Sqlite.SqliteStatement stmt) [0x00000] at Mono.Data.Sqlite.Sqlite3.Step (Mono.Data.Sqlite.SqliteStatement stmt) [0x00000] at Mono.Data.Sqlite.SqliteCommand.ExecuteNonQuery () [0x00000] at (wrapper remoting-invoke-with-check) Mono.Data.Sqlite.SqliteCommand:ExecuteNonQuery () at Hyena.Data.Sqlite.HyenaSqliteCommand.Execute (Hyena.Data.Sqlite.HyenaSqliteConnection hconnection, Mono.Data.Sqlite.SqliteConnection connection) [0x00000] The steps for recovery can be found in http://banshee-project.org/support/faq/. However, they require a sqlite3, and the user will have to poke around the command line to get it to work. Ideally, Banshee should catch this exception, warn the user that the database image is corrupted (without the user having to dig through ~/.config/banshee-1/log for this) and prompt the user if he/she wants to perform recovery onto it. Then, depending on the user's answer, recover and continue, or quit.
Confirming and assigning to myself. Anyone has a malformed sqlite database lying around?
I do, in fact! I think it failed several months ago, so the db version was old. When I started up Banshee with this db to make sure it fails, it did a metadata refresh. Even after the refresh, I still get a crash with the 'database disk image is malformed' error, so it should work. I'm assuming it's going to be too big to attach it here, so I'll add it to: http://www.martinsmucker.com/files/banshee.db
See also bug 616569, comment 4. (In reply to comment #2) > I do, in fact! I think it failed several months ago, so the db version was > old. When I started up Banshee with this db to make sure it fails, it did a > metadata refresh. Even after the refresh, I still get a crash with the > 'database disk image is malformed' error, so it should work. > > I'm assuming it's going to be too big to attach it here, so I'll add it to: > http://www.martinsmucker.com/files/banshee.db Thanks Michael!
(In reply to comment #3) > Thanks Michael! No problem. I'm sort of a pack-rat with my files... never would have guessed that a corrupt database would come in handy... ;) Anyway, it should be up now. I tested the link and it seemed to work.
Sorry, looks like I couldn't upload it to BGO (13M file). Here's the link: http://people.ubuntu.com/~hyperair/banshee.bkp.db
Just so you know, sqlite db files usually compress quite nicely.
(In reply to comment #6) > Just so you know, sqlite db files usually compress quite nicely. Ahh, thanks for the tip -- very impressive, actually. I've managed to get the file size of mine from 18MB down to 2MB, which is still to big to attach here, but I'm replacing my previous link, in case anyone else is interested. The new file is banshee.db.tar.bz2. This is actually really handy, since my web host is pretty stingy with storage space. They also aren't usually thrilled when I use my space for hosting/sharing files... :)
*** Bug 631146 has been marked as a duplicate of this bug. ***
*** Bug 631378 has been marked as a duplicate of this bug. ***
*** Bug 633443 has been marked as a duplicate of this bug. ***
As a further nod towards robustness, perhaps Banshee should make a backup copy of the DB when it starts successfully - that way it can offer a second level of possible recovery should the SQLite dump/restore fail for some reason.
Actually Banshee usually start successfully, I think. It's just that some operations later on don't apply or cause Banshee to crash.
(In reply to comment #12) > Actually Banshee usually start successfully, I think. It's just that some > operations later on don't apply or cause Banshee to crash. I think you're right. IIRC, the crashes generally happen when a song finishes playing or when Banshee tries to access (smart) playlists, but not when it starts up. Saving a backup copy of the database sounds like a good level of defense though, so would it work to do this as part of a successful, non-crashing shutdown routine?
Not necessarily. I could have launched Banshee (I used to do that upon startup), not played anything, and shutdown my system, logged out, or otherwise quit Banshee for some other reason. No errors would have been detected, but that does not mean my database is not corrupt.
*** Bug 636181 has been marked as a duplicate of this bug. ***
*** Bug 637674 has been marked as a duplicate of this bug. ***
*** Bug 637888 has been marked as a duplicate of this bug. ***
We seem to get these in a lot of bug reports and IRC visitors with these issues. I'll track the state separately for bug triaging here: http://live.gnome.org/Banshee/CommonQuestions
*** Bug 640907 has been marked as a duplicate of this bug. ***
*** Bug 642738 has been marked as a duplicate of this bug. ***
*** Bug 644852 has been marked as a duplicate of this bug. ***
*** Bug 647786 has been marked as a duplicate of this bug. ***
*** Bug 649648 has been marked as a duplicate of this bug. ***
*** Bug 651142 has been marked as a duplicate of this bug. ***
(In reply to comment #24) > *** Bug 651142 has been marked as a duplicate of this bug. *** Thanks but this seriously needs a quick fix as people will be put off the entire Linux platform with Windows like behaviour, we need to try and grow support not flatline.
*** Bug 657171 has been marked as a duplicate of this bug. ***
(In reply to comment #1) > Confirming and assigning to myself. > > Anyone has a malformed sqlite database lying around? Alex, I guess you're not working on this anymore? Changing status from ASSIGNED to NEW.
(In reply to comment #28) > Alex, I guess you're not working on this anymore? > Changing status from ASSIGNED to NEW. No, feel free to take it over ;)
*** Bug 660541 has been marked as a duplicate of this bug. ***
I have start to take a look to this bug. Catch this error on hyena is easy but the hard part is to done a system to recover db. I only see 2 solutions: - save db every X times and restore it each time we have an issue we will just lost what happend between 2 saves - depend on sqlite3 tool to make a dump and restore it. I prefer the first solution because it is easier and do not need an external dependancy.
I prefer the first solution as well. I've noticed that when an sqlite3 database is corrupted, using the sqlite3 binary to dump and restore the database does not always result in a perfect recovery. My liferea sqlite db died in that manner. Perhaps what we can do is to instead write to a banshee.db.journal, and at perfectly safe points (sync?), copy to banshee.db.tmp, sync, and rename to banshee.db?
Created attachment 202756 [details] [review] 1st patch to add an event on hyena here is a first patch which just add an event and fire it when db get corrupted.
Created attachment 202757 [details] [review] 2cd patch on banshee for db recover this 2cd patch add a new extension which is in charge of Save/restore DB file with a backup. This 2 patches are not final is just to have feedback. It compile but I have not test it.
Given that olivier's patch does backup the DB, I'm going to mark some bugs as duplicates of this. Hopefully I'll have time soon to review the patches.
*** Bug 599999 has been marked as a duplicate of this bug. ***
*** Bug 693947 has been marked as a duplicate of this bug. ***
*** Bug 697839 has been marked as a duplicate of this bug. ***
Ping... This is still an issue in Ubuntu 13.10 and I think it's a fairly big usability issue considering that it's pretty hard for regular users to go through the process over resolving this issue.
+1 for this, any progress lads?
Banshee is not under active development anymore and had its last code changes more than three years ago. Its codebase has been archived. Closing this report as WONTFIX as part of Bugzilla Housekeeping to reflect reality. Please feel free to reopen this ticket (or rather transfer the project to GNOME Gitlab, as GNOME Bugzilla is being shut down) if anyone takes the responsibility for active development again. See https://gitlab.gnome.org/Infrastructure/Infrastructure/issues/264 for more info.