GNOME Bugzilla – Bug 538206
Banshee crashes on Last.FM login
Last modified: 2008-09-04 16:55:04 UTC
Steps to reproduce: 1. Open Banshee 1.0.0 2. Click on the Last.FM source. 3. Banshee crashes with the below stack trace Stack trace: [Info 02:30:12.126] Running Banshee 1.0.0 [Info 02:30:15.267] All services are started 2,602562s [Info 02:30:19.979] nereid Client Started (Nereid:26267): GLib-GObject-CRITICAL **: g_object_unref: assertion `G_IS_OBJECT (object)' failed (Nereid:26267): GLib-GObject-CRITICAL **: g_object_unref: assertion `G_IS_OBJECT (object)' failed Exception in Gtk# callback delegate Note: Applications can use GLib.ExceptionManager.UnhandledException to handle the exception. System.Xml.XmlException: Not allowed character was found. Line 20, position 33. at Mono.Xml2.XmlTextReader.ReadText (Boolean notWhitespace) [0x00000] at Mono.Xml2.XmlTextReader.ReadContent () [0x00000] at Mono.Xml2.XmlTextReader.Read () [0x00000] at System.Xml.XmlTextReader.Read () [0x00000] at Mono.Xml.EntityResolvingXmlReader.Read () [0x00000] at Mono.Xml.Schema.XsdValidatingReader.Read () [0x00000] at System.Xml.XmlValidatingReader.Read () [0x00000] at System.Xml.XmlDocument.ReadNodeCore (System.Xml.XmlReader reader) [0x00000] at System.Xml.XmlDocument.ReadNodeCore (System.Xml.XmlReader reader) [0x00000] at System.Xml.XmlDocument.ReadNodeCore (System.Xml.XmlReader reader) [0x00000] at System.Xml.XmlDocument.ReadNode (System.Xml.XmlReader reader) [0x00000] at System.Xml.XmlDocument.Load (System.Xml.XmlReader xmlReader) [0x00000] at System.Xml.XmlDocument.Load (System.IO.TextReader txtReader) [0x00000] at Lastfm.Data.LastfmData`1[Lastfm.Data.RecentTrack].GetData () [0x0001d] in /build/buildd/banshee-1-1.0.0/src/Libraries/Lastfm/Lastfm.Data/LastfmData.cs:98 at Lastfm.Data.LastfmData`1[Lastfm.Data.RecentTrack]..ctor (System.String , CacheDuration , System.String ) [0x00040] in /build/buildd/banshee-1-1.0.0/src/Libraries/Lastfm/Lastfm.Data/LastfmData.cs:79 at Lastfm.Data.LastfmData`1[Lastfm.Data.RecentTrack]..ctor (System.String , System.String ) [0x00000] in /build/buildd/banshee-1-1.0.0/src/Libraries/Lastfm/Lastfm.Data/LastfmData.cs:62 at Lastfm.Data.LastfmUserData.Get[RecentTrack] (System.String fragment, System.String xpath) [0x00023] in /build/buildd/banshee-1-1.0.0/src/Libraries/Lastfm/Lastfm.Data/LastfmUserData.cs:67 at Lastfm.Data.LastfmUserData.Get[RecentTrack] (System.String fragment) [0x00000] in /build/buildd/banshee-1-1.0.0/src/Libraries/Lastfm/Lastfm.Data/LastfmUserData.cs:58 at Lastfm.Data.LastfmUserData.get_RecentTracks () [0x00000] in /build/buildd/banshee-1-1.0.0/src/Libraries/Lastfm/Lastfm.Data/LastfmUserData.cs:131 at Banshee.Lastfm.Radio.LastfmSourceContents.UpdateForUser (System.String username) [0x0011d] in /build/buildd/banshee-1-1.0.0/src/Extensions/Banshee.Lastfm/Banshee.Lastfm.Radio/LastfmSourceContents.cs:138 at Banshee.Lastfm.Radio.LastfmSourceContents+<>c__CompilerGenerated4.<HandleConnectionStateChanged>c__23 (System.Object +13, System.EventArgs +14) [0x00025] in /build/buildd/banshee-1-1.0.0/src/Extensions/Banshee.Lastfm/Banshee.Lastfm.Radio/LastfmSourceContents.cs:149 at Banshee.ServiceStack.Application+<>c__CompilerGenerated29.<Invoke>c__68 () [0x00000] in /build/buildd/banshee-1-1.0.0/src/Core/Banshee.Services/Banshee.ServiceStack/Application.cs:165 at Banshee.Gui.GtkBaseClient+<>c__CompilerGenerated18.<RunIdle>c__70 () [0x00000] in /build/buildd/banshee-1-1.0.0/src/Core/Banshee.ThickClient/Banshee.Gui/GtkBaseClient.cs:201 at GLib.Idle+IdleProxy.Handler () [0x00000] at GLib.ExceptionManager.RaiseUnhandledException(System.Exception e, Boolean is_terminal) at GLib.Idle+IdleProxy.Handler() at GLib.Idle+IdleProxy.Handler() at Gtk.Application.gtk_main() at Gtk.Application.gtk_main() at Gtk.Application.Run() at Banshee.Gui.GtkBaseClient.Run() in /build/buildd/banshee-1-1.0.0/src/Core/Banshee.ThickClient/Banshee.Gui/GtkBaseClient.cs:line 114 at Banshee.Gui.GtkBaseClient.Startup() in /build/buildd/banshee-1-1.0.0/src/Core/Banshee.ThickClient/Banshee.Gui/GtkBaseClient.cs:line 55 at Hyena.Gui.CleanRoomStartup.Startup(Hyena.Gui.StartupInvocationHandler startup) in /build/buildd/banshee-1-1.0.0/src/Libraries/Hyena.Gui/Hyena.Gui/CleanRoomStartup.cs:line 54 at Banshee.Gui.GtkBaseClient.Entry() in /build/buildd/banshee-1-1.0.0/src/Core/Banshee.ThickClient/Banshee.Gui/GtkBaseClient.cs:line 50 at Nereid.Client.Main(System.String[] args) in /build/buildd/banshee-1-1.0.0/src/Clients/Nereid/Nereid/Client.cs:line 77 Other information: This bug originated from here: https://bugs.launchpad.net/ubuntu/+source/banshee/+bug/239346 Although this user has experienced the bug, there are other Ubuntu Hardy users who do not experience this bug.
Bumping the version up due to confirmation that it still happens in 1.2.1 by Mattias Larsson.
I can confirm this on 1.2.1 also.
and SVN trunk.
Does this happen every time? What Last.fm stations do you have configured? Are you a Last.fm subscriber? Can you post the output of 'banshee-1 --debug'? And are there any other details you can add to help narrow down the problem?
Yes, repeatable every time. No stations added, and just to be double sure I purged my configuration and started again (.config/banshee-1 and gconf). No change. Attaching the --debug output now, although it is just the same as the previous one.
Created attachment 117349 [details] --debug output for last.fm crash
(In reply to comment #5) > Attaching the --debug output now, although it is just the same as the > previous one. The stacktrace may be, but I want to look at the preceding debug output from the time when Banshee starts. Thanks for attaching.
Created attachment 117352 [details] Printing out cache_file's contents I added a quick loop to print out cache_file's contents with line numbers when GetData is called in LastFmData.cs. Code here (inserted above line 101): StreamReader sr = new StreamReader (cache_file); for (int i = 0; !sr.EndOfStream; ++i) Console.WriteLine(String.Format("{0} {1}", i+1, sr.ReadLine())); The attached file shows the output of this. It looks like a specific track that I've played in the past is causing this crash - there are some weird characters in the tags.
Excellent, I've confirmed that what I posted above is indeed the cause - played a load of songs to move the problematic one off my last.fm recent playlist, cleared the cache and tried last.fm again. Hey presto, it works!
In that case, could you post the metadata of the song with the weird tags so it can get fixed or provide a patch?
It's in the cache_file attachment I posted, the line numbered 13. I've been messing with the code a bit, but am unable to fix it thus far. Thought it was an encoding issue but forcing utf-8 didn't make a difference.
The actual XML files that last.fm spits out are malformed, so I guess you could consider this a bug with their API.
Created attachment 117533 [details] [review] Patch to not check for invalid characters This patch will not check for invalid characters when reading XML data from Last.fm's API. The API accepts this data from clients and returns it to them - there's nothing we can really do about that (short of filing a bug) except trust that what it returns is right.
Comment on attachment 117533 [details] [review] Patch to not check for invalid characters >Index: src/Libraries/Lastfm/Lastfm.Data/LastfmData.cs >=================================================================== >--- src/Libraries/Lastfm/Lastfm.Data/LastfmData.cs (revision 4438) >+++ src/Libraries/Lastfm/Lastfm.Data/LastfmData.cs (working copy) >@@ -98,7 +98,11 @@ > > // Load the XML from the new or cached local file > doc = new XmlDocument (); >- using (StreamReader reader = new StreamReader (cache_file)) { >+ >+ XmlReaderSettings settings = new XmlReaderSettings(); >+ settings.CheckCharacters = false; >+ >+ using (XmlReader reader = XmlReader.Create(cache_file, settings)) { > doc.Load (reader); > } > >Index: ChangeLog >=================================================================== >--- ChangeLog (revision 4438) >+++ ChangeLog (working copy) >@@ -1,3 +1,9 @@ >+2008-08-28 Iain Lane <iain@orangesquash.org.uk> >+ >+ * src/Libraries/Lastfm/Lastfm.Data/LastfmData.cs: Don't validate >+ characters in XML returned from Last.fm - the API accepts (and returns) >+ invalid characters sent to it. >+ > 2008-08-27 Brad Taylor <brad@getcoded.net> > > * configure.ac:
Iain, Thanks for the patch. I think you modified the first version by editing the attachment, but having patches in comment makes them difficult to manage. There are still some small formatting issues : please add a space before opening parentheses (see the HACKING file for details) Could you attach a new version of your patch ?
Created attachment 117551 [details] [review] Patch to not check for invalid characters Right, sorry about that Bertrand. I hadn't anticipated what editing the patch would actually do, just thought it would *edit* it in place. Hopefully this one is OK - fixed tabbing and that missing space.
Thanks ! Looks good to me. Actually, there another space missing in "XmlReader.Create(", but let's not be spacing fanatics ;)
Looks good, thanks! Please commit, Bertrand.
Committed, thanks !