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 354092 - Unhandled exception while loading the database
Unhandled exception while loading the database
Status: RESOLVED OBSOLETE
Product: banshee
Classification: Other
Component: general
0.13.x
Other Linux
: Normal critical
: 0.13.x
Assigned To: Banshee Maintainers
Banshee Maintainers
: 397861 403365 419717 426361 477235 494036 (view as bug list)
Depends on: 412676
Blocks:
 
 
Reported: 2006-09-03 10:52 UTC by Ruben Vermeersch
Modified: 2008-08-15 00:46 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Corrupt Banshee Database (516.00 KB, application/octet-stream)
2007-01-01 20:40 UTC, Technodude
  Details
bad banshee db (217.43 KB, application/x-compressed-tar)
2007-01-18 13:02 UTC, Scott Ellington
  Details
banshee-cleanup-librarytrackremovedargs.patch (10.17 KB, patch)
2007-02-10 21:25 UTC, Ruben Vermeersch
committed Details | Review

Description Ruben Vermeersch 2006-09-03 10:52:03 UTC
Wonderfull crash when loading banshee, makes it unstartable. Started a week or two ago (while I was still running dapper).


An unhandled exception was thrown: The given key was not present in the dictionary.

at System.Collections.Generic.Dictionary`2.get_Item (int) [0x00023] in /build/buildd/mono-1.1.16.1/mcs/class/corlib/System.Collections.Generic/Dictionary.cs:94
at Banshee.Sources.PlaylistSource.LoadFromDatabase () [0x000ca] in /home/ruben/Programming/Gnome/banshee/banshee-cvs/src/Banshee.Base/Sources/PlaylistSource.cs:149
at Banshee.Sources.PlaylistSource..ctor (int) [0x00065] in /home/ruben/Programming/Gnome/banshee/banshee-cvs/src/Banshee.Base/Sources/PlaylistSource.cs:86
at Banshee.Sources.PlaylistUtil.LoadSources () [0x00020] in /home/ruben/Programming/Gnome/banshee/banshee-cvs/src/Banshee.Base/Sources/PlaylistSource.cs:401
at Banshee.Sources.LibrarySource.LoadPlaylists () [0x00000] in /home/ruben/Programming/Gnome/banshee/banshee-cvs/src/Banshee.Base/Sources/LibrarySource.cs:82
at Banshee.Sources.LibrarySource..ctor () [0x00085] in /home/ruben/Programming/Gnome/banshee/banshee-cvs/src/Banshee.Base/Sources/LibrarySource.cs:76
at Banshee.Sources.LibrarySource.get_Instance () [0x0000b] in /home/ruben/Programming/Gnome/banshee/banshee-cvs/src/Banshee.Base/Sources/LibrarySource.cs:44
at Banshee.PlayerUI.OnLibraryReloaded (object,System.EventArgs) [0x00013] in /home/ruben/Programming/Gnome/banshee/banshee-cvs/src/PlayerInterface.cs:603
at (wrapper delegate-invoke) System.MulticastDelegate.invoke_void_object_EventArgs (object,System.EventArgs) <0x00041>
at <>AnonHelp<48>.<#AnonymousMethod>67 (object,System.EventArgs) <0x0003d>
at (wrapper delegate-invoke) System.MulticastDelegate.invoke_void_object_EventArgs (object,System.EventArgs) <0x00041>
at InvokeCB.Invoke () <0x0001a>
at (wrapper delegate-invoke) System.MulticastDelegate.invoke_bool () <0x00037>
at TimeoutProxy.Handler () <0x0002a>
at (wrapper native-to-managed) TimeoutProxy.Handler () <0x00036>
in (unmanaged) 0xb7cfbe45
at (wrapper managed-to-native) Gtk.Application.gtk_main () <0x00004>
at Gtk.Application.Run () <0x00007>
at Banshee.BansheeEntry.Startup (string[]) [0x00224] in /home/ruben/Programming/Gnome/banshee/banshee-cvs/src/Main.cs:92
at (wrapper delegate-invoke) System.MulticastDelegate.invoke_void_string[] (string[]) <0x00048>
at Banshee.Gui.CleanRoomStartup.Startup (Banshee.Gui.CleanRoomStartup/StartupInvocationHandler,string[]) [0x00045] in /home/ruben/Programming/Gnome/banshee/banshee-cvs/src/Banshee.Base/Gui/CleanRoomStartup.cs:54

.NET Version: 2.0.50727.42

Assembly Version Information:

System.Configuration (2.0.0.0)
Mono.Security (2.0.0.0)
System.Xml (2.0.0.0)
NotificationAreaIcon (0.11.0.29704)
MusicBrainz (0.11.0.29622)
MetadataSearch (0.11.0.29703)
MMKeys (0.11.0.29703)
avahi-sharp (1.0.0.0)
Daap (0.11.0.29701)
Banshee.Plugins.Audioscrobbler (0.11.0.29700)
Audioscrobbler (0.11.0.24757)
burn-sharp (0.0.0.0)
gnome-vfs-sharp (2.16.0.0)
Banshee.Dap.MassStorage (0.11.0.29698)
hal-sharp (0.0.0.0)
GStreamerPlayerEngine (0.11.0.29697)
System.Data (2.0.0.0)
Mono.Data.SqliteClient (2.0.0.0)
Mono.CompilerServices.SymbolWriter (2.0.0.0)
DBusProxy (0.0.0.0)
pango-sharp (2.10.0.0)
Mono.Posix (2.0.0.0)
Banshee.Widgets (0.11.0.29691)
glade-sharp (2.10.0.0)
gnome-sharp (2.16.0.0)
dbus-sharp (0.60.0.0)
gconf-sharp (2.16.0.0)
gdk-sharp (2.10.0.0)
System (2.0.0.0)
atk-sharp (2.10.0.0)
glib-sharp (2.10.0.0)
gtk-sharp (2.10.0.0)
Banshee.Base (0.11.0.22662)
banshee (0.11.0.29706)
mscorlib (2.0.0.0)

Platform Information: Linux 2.6.17-6-686 i686 unknown GNU/Linux

Disribution Information:

[/etc/debian_version]
testing/unstable

[/etc/lsb-release]
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=6.10
DISTRIB_CODENAME=edgy
DISTRIB_DESCRIPTION="Ubuntu edgy (development branch)"
Comment 1 Ruben Vermeersch 2006-09-03 18:48:43 UTC
Seems like I had a corrupted database. Moving it out of the way fixes it. I still have the broken database, but I'm not really sure if I want to debug it. Atleast not at this moment.
Comment 2 Ricardo Fuentes 2006-12-05 18:02:30 UTC
<a href="https://launchpad.net/distros/ubuntu/+source/banshee/+bug/72969">
       Bug #72969</a> Duplicated!
Comment 3 Ricardo Fuentes 2006-12-05 18:06:05 UTC
Duplicated https://launchpad.net/distros/ubuntu/+source/banshee/+bug/72969
Comment 4 Ruben Vermeersch 2006-12-09 11:59:41 UTC
I am going to close this one, as I can no longer reproduce it. I assume that it was a one-time error.
Comment 5 Ricardo Fuentes 2006-12-10 03:25:33 UTC
The error /exist/. I'm happend for this.
Comment 6 Ruben Vermeersch 2006-12-10 09:55:41 UTC
can you attach a photos.db that crashes?
Comment 7 Ricardo Fuentes 2006-12-17 19:13:50 UTC
No, because the .banshee directory don't exist. For a reason, this be deleted. To another people too happend the same thing. :(
Comment 8 Ruben Vermeersch 2006-12-24 17:02:02 UTC
I'm going to close this bug then. If you (or someone else) manage to find a corrupt banshee.db (not photos.db, that's f-spot, ooops :-)), please reopen this bug, I'll have a look at it then.
Comment 9 Technodude 2007-01-01 20:40:22 UTC
Created attachment 79152 [details]
Corrupt Banshee Database

Here is a copy of the corrupt database file.
Comment 10 Ricardo Fuentes 2007-01-07 07:11:29 UTC
I compile Banshee from the SVN and i have the same problem. Exactly the same. :/ I think this is a critical bug. :(
Comment 11 Ruben Vermeersch 2007-01-18 08:24:14 UTC
*** Bug 397861 has been marked as a duplicate of this bug. ***
Comment 12 Scott Ellington 2007-01-18 13:02:21 UTC
Created attachment 80591 [details]
bad banshee db
Comment 13 Ruben Vermeersch 2007-02-09 15:26:28 UTC
Assigning, raising priority, going to have a good look at this, cause I want to it fixed. Before 0.12 if possible...
Comment 14 Ruben Vermeersch 2007-02-10 20:17:48 UTC
Ok, here's what I found is wrong:

There are entries in the PlaylistEntries table with an invalid TrackID. This might've been caused by deleting a track without deleting the entries in the PlaylistEntries table.

Two steps needed in fixing this:
 1) Make sure this never ever happens again. For real, we don't want a corrupt database, so all code paths involving deleting a track should be checked to be correct. Will do that first.
 2) Since the corruption isn't anything that fatal, we can safely detect this at runtime and drop the invalid data. This way users with a broken database will be able to use banshee, without deleting their database (the bug was just automagically fixed after upgrading banshee).

Starting with step 1...
Comment 15 Ruben Vermeersch 2007-02-10 20:49:01 UTC
Aaron: There's a lot of duplicated code because of the definition of LibraryTrackRemovedArgs. Currently it's defined like this:

public class LibraryTrackRemovedArgs : EventArgs {
    public LibraryTrackInfo Track;
    public ICollection Tracks;
}

Which means we have to handle the case for both Track and Tracks in every implementation that uses this class, else things might go wrong. Is there a special reason why this is like this? Also, I'd like to propose a patch that removes all this duplication, basically removing all the double code. The only difference that might cause would be the case with only one LibraryTrackInfo, but iterating over a collection with only one element isn't that much slower (if we're firing of _a lot_ of these events, we want to group them in one event anyway). It does however make it a lot harder for us to screw up things, as we don't have to handle both cases exactly the same way every time we use LibraryTrackRemovedArgs.
Comment 16 Ruben Vermeersch 2007-02-10 21:25:39 UTC
Created attachment 82300 [details] [review]
banshee-cleanup-librarytrackremovedargs.patch

Here's the proposed cleanup:

Clean up LibraryTrackRemovedArgs.

This patch changes the definition of LibraryTrackRemovedArgs from
    { LibraryTrackInfo Track, ICollection Tracks }
to
    { ICollection<LibraryTrackInfo> Tracks }

This causes a couple of things:

The first goal was to simplify all methods handling LibraryTrackRemovedArgs.
Now they only have to handle the single Tracks attribute. This removes a lot of
duplicated code. Each method handling the TrackRemoved signal basically had to
implement itself twice, this has now been reduced to once.

While working on this, I changed Tracks to be a generic class of
LibraryTrackInfo objects. This improves type safety, with the current code, it
was possible to have both LibraryTrackInfo objects and SafeUri objects in the
Tracks attribute. Luckily, the possibility to use SafeUris isn't used anywhere,
as no code implements functionality to handle this.

 Core/Banshee.Base/Banshee.SmartPlaylist/SmartPlaylistSource.cs |   10 -
 Core/Banshee.Base/Library.cs                                   |   42 +----
 Core/Banshee.Base/Sources/LibrarySource.cs                     |    4 
 Core/Banshee.Base/Sources/PlaylistSource.cs                    |   16 --
 Plugins/Banshee.Plugins.Podcast/PodcastLibrary.cs              |   78 ++--------
 5 files changed, 39 insertions(+), 111 deletions(-)
Comment 17 Quasar Jarosz 2007-02-18 21:05:25 UTC
I just encountered this error, and figured out myself that it was a problem with the playlists (i couldn't get this bug to display for some reason..)

I had imported a collection of around 2000 songs.. then i had created a playlist with a few hundred songs, then i re-imported the original 2000 songs (because i was afraid there were some new ones). Banshee displayed most of these songs in the Error log showing that they were duplicate songs. I then right clicked on the error log and clicked Close (or hide, whatever it shows). This caused banshee to hang.. so after a while i killed it, and when i tried to restart, i had the broken database file (that is, the db was NOT corrupt, it just had bad data in the playlist table).

Hope that might help..
Comment 18 Ruben Vermeersch 2007-04-02 10:59:43 UTC
Setting patch status to committed as it is in my branch (which should go to trunk soon).

Quasar: I will try that soon, hopefully I can reproduce it too, thanks for the hint, it would be an awesome step forward if that is what causes it.
Comment 19 Ruben Vermeersch 2007-04-11 10:46:01 UTC
*** Bug 403365 has been marked as a duplicate of this bug. ***
Comment 20 Josiah Ritchie - flickerfly 2007-08-23 02:17:34 UTC
Ruben, has your branch been merged in so we can close this now?
Comment 21 Andrew Conkling 2007-11-06 15:13:21 UTC
Duplicate bug #494036 indicates that this didn't make it into 0.13.1. Can the target be updated and that bug marked as a duplicate?
Comment 22 Andrew Conkling 2007-11-29 14:44:12 UTC
*** Bug 494036 has been marked as a duplicate of this bug. ***
Comment 23 Andrew Conkling 2008-02-07 19:37:13 UTC
*** Bug 419717 has been marked as a duplicate of this bug. ***
Comment 24 Andrew Conkling 2008-02-07 19:38:04 UTC
*** Bug 426361 has been marked as a duplicate of this bug. ***
Comment 25 Andrew Conkling 2008-02-07 19:38:39 UTC
*** Bug 477235 has been marked as a duplicate of this bug. ***
Comment 26 Andrew Conkling 2008-02-07 19:42:19 UTC
(In reply to comment #20)
> Ruben, has your branch been merged in so we can close this now?

And if not, can we get it merged ASAP?
Comment 27 Ruben Vermeersch 2008-02-16 20:03:44 UTC
It won't get merged, as we have totally rewritten that part in trunk. Note that the patch doesn't fix the issue yet, it just prevents the corruption from occurring again.

It might be the case that this has already been fixed in a different way (and won't occur again).
Comment 28 Ruben Vermeersch 2008-02-16 20:05:17 UTC
Setting bug version to 0.13.x, as it has nothing to do with trunk (and shouldn't happen there).