After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 621057 - Should detect fatal database (corruption; sqlite db malformed) errors and prompt for recovery (from a backup?)
Should detect fatal database (corruption; sqlite db malformed) errors and pro...
Status: RESOLVED WONTFIX
Product: banshee
Classification: Other
Component: general
git master
Other Linux
: High normal
: ---
Assigned To: Banshee Maintainers
Banshee Maintainers
gnome[unmaintained]
: 599999 631146 631378 633443 636181 637674 637888 640907 642738 644852 647786 649648 651142 657171 660541 693947 697839 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2010-06-09 03:50 UTC by Chow Loong Jin
Modified: 2020-03-17 08:58 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
1st patch to add an event on hyena (2.34 KB, patch)
2011-12-04 16:12 UTC, olivier dufour
none Details | Review
2cd patch on banshee for db recover (12.26 KB, patch)
2011-12-04 16:19 UTC, olivier dufour
none Details | Review

Description Chow Loong Jin 2010-06-09 03:50:48 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.
Comment 1 Alexander Kojevnikov 2010-06-09 04:01:54 UTC
Confirming and assigning to myself.

Anyone has a malformed sqlite database lying around?
Comment 2 Michael Martin-Smucker 2010-06-09 04:14:06 UTC
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
Comment 3 Alexander Kojevnikov 2010-06-09 04:16:10 UTC
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!
Comment 4 Michael Martin-Smucker 2010-06-09 04:20:03 UTC
(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.
Comment 5 Chow Loong Jin 2010-06-09 05:43:36 UTC
Sorry, looks like I couldn't upload it to BGO (13M file). Here's the link: http://people.ubuntu.com/~hyperair/banshee.bkp.db
Comment 6 Gabriel Burt 2010-06-10 17:28:54 UTC
Just so you know, sqlite db files usually compress quite nicely.
Comment 7 Michael Martin-Smucker 2010-06-10 21:25:49 UTC
(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... :)
Comment 8 Michael Martin-Smucker 2010-10-02 02:05:14 UTC
*** Bug 631146 has been marked as a duplicate of this bug. ***
Comment 9 Alexander Kojevnikov 2010-10-05 05:24:42 UTC
*** Bug 631378 has been marked as a duplicate of this bug. ***
Comment 10 Michael Martin-Smucker 2010-10-29 12:55:29 UTC
*** Bug 633443 has been marked as a duplicate of this bug. ***
Comment 11 Jo Shields 2010-11-01 11:38:14 UTC
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.
Comment 12 Chow Loong Jin 2010-11-02 18:15:43 UTC
Actually Banshee usually start successfully, I think. It's just that some operations later on don't apply or cause Banshee to crash.
Comment 13 Michael Martin-Smucker 2010-11-02 18:54:14 UTC
(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?
Comment 14 Chow Loong Jin 2010-11-02 19:03:37 UTC
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.
Comment 15 Michael Martin-Smucker 2010-12-01 01:25:00 UTC
*** Bug 636181 has been marked as a duplicate of this bug. ***
Comment 16 Michael Martin-Smucker 2010-12-20 16:32:51 UTC
*** Bug 637674 has been marked as a duplicate of this bug. ***
Comment 17 Alexander Kojevnikov 2010-12-23 17:07:19 UTC
*** Bug 637888 has been marked as a duplicate of this bug. ***
Comment 18 David Nielsen 2010-12-23 18:06:38 UTC
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
Comment 19 Bertrand Lorentz 2011-01-29 20:00:09 UTC
*** Bug 640907 has been marked as a duplicate of this bug. ***
Comment 20 Michael Martin-Smucker 2011-02-19 13:38:59 UTC
*** Bug 642738 has been marked as a duplicate of this bug. ***
Comment 21 Michael Martin-Smucker 2011-03-21 15:46:27 UTC
*** Bug 644852 has been marked as a duplicate of this bug. ***
Comment 22 Bertrand Lorentz 2011-04-15 14:36:41 UTC
*** Bug 647786 has been marked as a duplicate of this bug. ***
Comment 23 Michael Martin-Smucker 2011-05-07 12:29:45 UTC
*** Bug 649648 has been marked as a duplicate of this bug. ***
Comment 24 Andrés G. Aragoneses (IRC: knocte) 2011-05-26 14:16:00 UTC
*** Bug 651142 has been marked as a duplicate of this bug. ***
Comment 25 abu-bakr 2011-05-26 21:20:01 UTC
(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.
Comment 26 Andrés G. Aragoneses (IRC: knocte) 2011-05-26 21:27:00 UTC
*** Bug 651142 has been marked as a duplicate of this bug. ***
Comment 27 Michael Martin-Smucker 2011-08-23 17:19:15 UTC
*** Bug 657171 has been marked as a duplicate of this bug. ***
Comment 28 Andrés G. Aragoneses (IRC: knocte) 2011-08-23 17:33:26 UTC
(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.
Comment 29 Alexander Kojevnikov 2011-08-24 04:07:44 UTC
(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 ;)
Comment 30 Andrés G. Aragoneses (IRC: knocte) 2011-10-14 22:33:09 UTC
*** Bug 660541 has been marked as a duplicate of this bug. ***
Comment 31 olivier dufour 2011-12-03 18:47:29 UTC
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.
Comment 32 Chow Loong Jin 2011-12-04 04:21:50 UTC
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?
Comment 33 olivier dufour 2011-12-04 16:12:03 UTC
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.
Comment 34 olivier dufour 2011-12-04 16:19:38 UTC
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.
Comment 35 Andrés G. Aragoneses (IRC: knocte) 2013-02-16 12:00:34 UTC
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.
Comment 36 Andrés G. Aragoneses (IRC: knocte) 2013-02-16 12:01:22 UTC
*** Bug 599999 has been marked as a duplicate of this bug. ***
Comment 37 Andrés G. Aragoneses (IRC: knocte) 2013-02-16 12:02:11 UTC
*** Bug 693947 has been marked as a duplicate of this bug. ***
Comment 38 Bertrand Lorentz 2013-04-14 10:10:05 UTC
*** Bug 697839 has been marked as a duplicate of this bug. ***
Comment 39 shaneonabike 2014-06-16 17:58:16 UTC
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.
Comment 40 Simon Dedman 2016-10-05 15:03:02 UTC
+1 for this, any progress lads?
Comment 41 André Klapper 2020-03-17 08:58:55 UTC
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.