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 538354 - Playing next song crashes banshee
Playing next song crashes banshee
Status: RESOLVED FIXED
Product: banshee
Classification: Other
Component: Playback
1.0.0
Other All
: Normal critical
: 1.x
Assigned To: Banshee Maintainers
Banshee Maintainers
: 539513 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2008-06-14 18:51 UTC by lcid-fire
Modified: 2008-09-09 23:48 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Reset the value of last_cover_art_scan if it is malformed (1.35 KB, patch)
2008-06-19 18:32 UTC, Bertrand Lorentz
committed Details | Review

Description lcid-fire 2008-06-14 18:51:09 UTC
Steps to reproduce:
1. I have very frequently the situation where automaticly changing from one song to another banshee crashes

Stack trace:
Unhandled Exception: System.FormatException: String was not recognized as a valid DateTime.
  at System.DateTime.Parse (System.String s, IFormatProvider fp, DateTimeStyles styles) [0x00212] in /build/buildd/mono-1.2.6+dfsg/mcs/class/corlib/System/DateTime.cs:947 
  at System.DateTime.Parse (System.String s, IFormatProvider fp) [0x00000] in /build/buildd/mono-1.2.6+dfsg/mcs/class/corlib/System/DateTime.cs:880 
  at System.Convert.ToDateTime (System.String value, IFormatProvider provider) [0x0000c] in /build/buildd/mono-1.2.6+dfsg/mcs/class/corlib/System/Convert.cs:718 
  at System.String.System.IConvertible.ToDateTime (IFormatProvider provider) [0x00000] in /build/buildd/mono-1.2.6+dfsg/mcs/class/corlib/System/String.cs:1854 
  at System.Convert.ToType (System.Object value, System.Type conversionType, IFormatProvider provider) [0x001f6] in /build/buildd/mono-1.2.6+dfsg/mcs/class/corlib/System/Convert.cs:2912 
  at System.Convert.ChangeType (System.Object value, System.Type conversionType) [0x00040] in /build/buildd/mono-1.2.6+dfsg/mcs/class/corlib/System/Convert.cs:2482 
  at Banshee.Configuration.DatabaseConfigurationClient.Get[DateTime] (System.String namespce, System.String key, DateTime fallback) [0x00014] in /build/buildd/banshee-1-1.0.0/src/Core/Banshee.Services/Banshee.Configuration/DatabaseConfigurationClient.cs:89 
  at Banshee.Configuration.DatabaseConfigurationClient.Get[DateTime] (System.String key, DateTime fallback) [0x00000] in /build/buildd/banshee-1-1.0.0/src/Core/Banshee.Services/Banshee.Configuration/DatabaseConfigurationClient.cs:82 
  at Banshee.CoverArt.CoverArtService.FetchCoverArt (Boolean force) [0x0003a] in /build/buildd/banshee-1-1.0.0/src/Extensions/Banshee.CoverArt/Banshee.CoverArt/CoverArtService.cs:161 
  at Banshee.CoverArt.CoverArtService.FetchCoverArt () [0x00022] in /build/buildd/banshee-1-1.0.0/src/Extensions/Banshee.CoverArt/Banshee.CoverArt/CoverArtService.cs:152 
  at Banshee.CoverArt.CoverArtService.OnTracksChanged (Banshee.Sources.Source sender, Banshee.Sources.TrackEventArgs args) [0x00000] in /build/buildd/banshee-1-1.0.0/src/Extensions/Banshee.CoverArt/Banshee.CoverArt/CoverArtService.cs:186 
  at (wrapper delegate-invoke) System.MulticastDelegate:invoke_void_Source_TrackEventArgs (Banshee.Sources.Source,Banshee.Sources.TrackEventArgs)
  at (wrapper delegate-invoke) System.MulticastDelegate:invoke_void_Source_TrackEventArgs (Banshee.Sources.Source,Banshee.Sources.TrackEventArgs)
  at Banshee.Sources.PrimarySource+<>c__CompilerGenerated16.<OnTracksChanged>c__52 () [0x0004d] in /build/buildd/banshee-1-1.0.0/src/Core/Banshee.Services/Banshee.Sources/PrimarySource.cs:368 
  at (wrapper delegate-invoke) System.MulticastDelegate:invoke_void ()


Other information:
Comment 1 Andrew Conkling 2008-06-14 20:21:01 UTC
On an offchance (thinking of 525178), can you try disabling the Podcasting extension to see if it helps?

If not, any reproducible steps? Can you provide some more details about which tracks you're playing?
Comment 2 Bertrand Lorentz 2008-06-17 19:49:15 UTC
I don't think it's related to bug 525178. It looks like you have a bad value for the "last_cover_art_scan" configuration key in your database.

Could you please paste the result of the following command :

sqlite3 ~/.config/banshee-1/banshee.db "select * from CoreConfiguration;"
Comment 3 lcid-fire 2008-06-18 05:39:54 UTC
As you wish:
1|DatabaseVersion|11
2|MetadataVersion|1
3|CoreTracks.ModelVersion|1
4|Database.Version|1
5|CoreArtists.ModelVersion|1
6|CoreAlbums.ModelVersion|1
7|HaveCreatedSmartPlaylists.MusicLibrarySource-Library|True
8|HaveCreatedSmartPlaylists.VideoLibrarySource-VideoLibrary|True
9|SmartPlaylistVersion|1
10|Podcast.Version|3
11|last_cover_art_scan|14/06/2008 13:37:51


Perhaps one important thing to nice is:
I'm running a cloned banshee on this machine. Which means I copy the .config/banshee-1 and Music content to this machine from another one (the primary one - where banshee is working quite normally). This has been working great in the past but perhaps banshee 1 got a little picky here?
Comment 4 Bertrand Lorentz 2008-06-18 18:16:29 UTC
I think I got it : aren't your two machines using different locale settings (date format, etc.) ?
Check the value of the LC_ALL environment variable.

I was able to reproduce the crash by changing its value on my machine. The value for the last_cover_art_scan key is a date stored as a string that is locale dependent. When we try to parse it in a different locale, we fail and crash.

As a workaround for you, you can delete the offending value by running :

sqlite3 ~/.config/banshee-1/banshee.db "delete from CoreConfiguration where key='last_cover_art_scan';"

The entry will be recreated the next time banshee is run.

To properly fix this, we should probably change the format used to store last_cover_art_scan.
Comment 5 lcid-fire 2008-06-18 19:14:18 UTC
Your totally right - that fixed it - thanks. Come by and grab a cookie :)
Comment 6 Bertrand Lorentz 2008-06-19 18:32:46 UTC
Created attachment 113063 [details] [review]
Reset the value of last_cover_art_scan if it is malformed

With this patch, banshee will reset the value of last_cover_art_scan to DateTime.MinValue if there's anything wrong with it.
It's a bit crude, but at worst it will trigger an unnecessary covert art fetch, instead of a crash.
Comment 7 lcid-fire 2008-06-19 20:31:42 UTC
That's more a workaround. I mean it's fine since for whatever reasons this can happen - but the basic problem is calling ToString() in DatabaseConfigurationClient's Set method.

I'd say for DateTime the stringify should be changed from .ToString() to .ToString("u")
Comment 8 Gabriel Burt 2008-06-20 01:12:17 UTC
Yeah, should be calling ToString with the System.Globalization.DateTimeFormatInfo.InvariantInfo
Comment 9 Bertrand Lorentz 2008-06-20 19:01:00 UTC
I must be missing something, or my generics knowledge is even worse than I thought, but I can't figure out how to do this in DatabaseConfigurationClient.Set <T>.

How am I supposed to cast a T into a DateTime ? "as" or regular cast don't work.
Comment 10 lcid-fire 2008-06-21 15:48:49 UTC
Well the sad thing is that constraints are not negateable - because then I'd say you could write:

<SetMethodDeclaration> where T !: DateTime
{
//use .ToString()
}

<SetMethodDeclaration> where T : DateTime
{
//use .ToString(System.Globalization.DateTimeFormatInfo.InvariantInfo);
}

and I have never tried whether overloading for specific types works:

<SetMethodDeclaration> where T : DateTime

<SetMethodDeclaration> //no constraint

But something tells me it doesn't.

So the thing you could do is
if(ref is DateTime)
  string = ref.ToString(System.Globalization.DateTimeFormatInfo.InvariantInfo);
else if(ref is float || ref is double)
  string = ref.ToString("0.0"); //a similar problem arises here
else
  string = ref.ToString();

But on the other end - the reading method also has to understand the formats!
Comment 11 Bertrand Lorentz 2008-06-21 23:48:58 UTC
*** Bug 539513 has been marked as a duplicate of this bug. ***
Comment 12 Gabriel Burt 2008-06-24 22:30:54 UTC
So, the issue is that DatabaseConfigurationClient doesn't use the Hyena.Data.Sqlite utilities for converting values to/from database-stored values.  I'm trying to get my unit tests working again to make sure we don't mess anything up w/ this change.
Comment 13 Gabriel Burt 2008-09-09 23:48:03 UTC
OK, sorry, should have done this a while ago - I committed Bertrand's workaround since the proper fix hasn't gotten done and this is definitely not worth crashing b/c of.  No where else do we use the db config client for dates, so we're safe besides this.