GNOME Bugzilla – Bug 542117
Banshee crashes when inserting mtp device (using libmtp8)
Last modified: 2009-06-02 22:21:56 UTC
Banshe crashes when inserting mtp device (using libmtp8 (0.3.0)) Please, fix support for libmtp8 (0.3.0), as now banshee 1 compiles with it, but crashes, when plugging MTP device (in my case ZEN Vision:M 30 GB, libmtp 0.3.0, Ubuntu Linux 8.04 x86_64). Maybe it's because of big API change in libmtp, but I'm not sure. PTP: Opening session Stacktrace: Native stacktrace: banshee-1 [0x539c29] banshee-1 [0x43f9ed] /lib/libc.so.6 [0x7f6aa9f88120] /lib/libc.so.6(strlen+0x10) [0x7f6aa9fd7740] banshee-1(mono_string_new+0x2a) [0x4a876a] [0x4115c1a5]
Bump. Banshee doesn't work with libmtp 0.3.* at all.
Created attachment 117829 [details] [review] Patch for changed API in libmtp by Salah Coronya. It's a patch from Gentoo bugzilla, bug #http://bugs.gentoo.org/show_bug.cgi?id=233869 (http://bugs.gentoo.org/show_bug.cgi?id=http://bugs.gentoo.org/show_bug.cgi?id=233869). It doesn't work for me (Creative ZEN Vision:M), maybe it does work for others, but anyway there's something to work on. Patch was kindly provided by Salah Coronya.
I just tested it with my (well my gf's sansa e260) and banshee still freezes/crashes with this patch while trying to load the dap. Sadly this device is not supported by libmtp 0.2.x (at least mtp-detect does not find it) so I'm forced to wait for 0.3.x support in banshee. Rhythmbox is able to display the device just find using it's MTP support btw.
(In reply to comment #3) > I just tested it with my (well my gf's sansa e260) and banshee still > freezes/crashes with this patch while trying to load the dap. > > Sadly this device is not supported by libmtp 0.2.x (at least mtp-detect does > not find it) so I'm forced to wait for 0.3.x support in banshee. > > Rhythmbox is able to display the device just find using it's MTP support btw. > Could you run banshee --debug and show us debugging info?
Sure, what do you need exactly? I mean, debug output with libmtp 0.2.6, 0.3.0 or 0.3.1?
With 0.3.0 or 0.3.1. Not for me. But I'm sure it'll be usefull for banshee developers. And watch #233869 on Gentoo bugzilla.
Created attachment 117837 [details] Debug log with 0.3.1 Here it is. I've run mtp-detect before banshee to show that the device is found.
Created attachment 117904 [details] [review] Update to the previous patch. "Works for me" There's a new patch from Gentoo bugzilla #233869 by Salah Coronya. This time it works with my Zen Vision:M. Please test it;)
Created attachment 117918 [details] Debug log with 0.3.1 and latest patch I can confirm that it does not longer crash. I still get some exceptions, though (see the new log). Also, I cannot really do anything... playback from the device fails, I can transfer a file to it but it does not show up in the list after that (neither in banshee nor on the device itself)... but that may just mean the e260 is not really supported by libmtp atm.
Have you tried with both libmtp 0.3.0 and 0.3.1? I had problems with the latest.
Seems to be exactly the same with 0.3.0. I just noticed that those exceptions only happen on eject (e.g. if I use the eject action). Does that not happen for you?
I guess that, with the patch applied, banshee won't work with libmtp 0.2 anymore ? If yes, the required version should be updated in build/m4/banshee/dap-mtp.m4.
Yes, of course. Rhythmbox guys have already tweaked their configure script, so why wait;)
Also, it's save to assume that the next round of distributions will all ship mtp 0.3.x
But the developers can also make it detect libmtp version and adapt to it, like rhythmbox devs did.
Created attachment 118023 [details] Debug log for transferring files to Zen Vision:M using libmtp 0.3.0 When i try to transfer files to device, it crashes at first transfer (using libmtp 0.3.0)
This is from the Changelog in banshee's trunk: "2008-09-05 Gabriel Burt <> * src/Extensions/Banshee.Podcasting/Banshee.Podcasting.Gui/DownloadManager/DownloadUserJob.cs: * src/Extensions/Banshee.Podcasting/Banshee.Podcasting.Gui/DownloadManager/DownloadManagerInterface.cs: Slightly more useful job status, shows how many total downloads in the job * src/Libraries/Mtp/Mtp/Track.cs: Hack around .m4v issue. * build/m4/banshee/dap-mtp.m4: * NEWS: Don't allow libmtp8 for now, and clarify how packages need to require libmtp (to ensure users have the same version the package was compiled against)." So developers don't plan to include libmtp too soon....
This patch (and the libmtp 0.3.0 API) seems to not have a way of setting the parent_id (eg Folder) for a Track? Eg this: - if (LIBMTP_Send_Track_From_File (handle, path, ref metadata, callback, data, parent) != 0) + if (LIBMTP_Send_Track_From_File (handle, path, ref metadata, callback, data) != 0) I'd assume it still has a way to set this (perhaps just in the 'metadata' struct itself) but that needs to be done in this patch before it's acceptable. Reducing Severity to Normal since we've clarified what versions of libmtp we support.
There is new version of patch downstream if you want to take a look at it. http://bugs.gentoo.org/show_bug.cgi?id=233869
Created attachment 118414 [details] [review] New version of libmt8 patch This is the new version of patch that really works, eg. I can list delete, and transfer music to my Zen Vision:M.
Created attachment 118481 [details] [review] Patch to fix compile against mtp-0.3 against HEAD Yes, parentID is part of "metadata" now. It is set in MtpDevice.cs, in the UploadTrack() function. However it sets the struct directly instead of using the accessors, so i adedd accessors to Track and Album and make UploadTrack() use the accessor function instead.
Salah, thanks a lot for the patches, it looks fine except we need to stay compatible with previous versions of libmtp. If you have time to add that run-time compatibility that would be wonderful, and would get committed quickly.
Gabriel, would it be possible to make two copies of MTP plugin in banshee's tree, and use patched in case of detected libmtp8, and the other if we have older? Or make ./configure patch source when libmtp8 detected?
Both of those are possible, but neither are how I'd like to see it done.
I'm working on the compatibility, using #if preprocessor directives to, as Mieszko was suggesting, only patch the files for libmtp8 support as appropriate.
Salah and Mieszko, thanks a lot for your work on this. I committed the last patch with #if/else around to support the older versions of libmtp still. Thanks!
Created attachment 119283 [details] banshee svn crash log just tried svn version (r4600) configured with --prefix=/home/onip/mybanshee --exec-prefix=/home/onip/mybanshee my mtp device (Creative Zen Xtra) is recognized, songs are scanned (it takes 100% cpu...) and at the end of scanning banshee crashes (IMHO this log i'm posting won't be usefull, but you know best)
Andrea: using mtp 0.3.x I suppose? I can't test this myself atm because I don't have the mtp device here but I will test on friday.
mtp-0.3.1
(In reply to comment #27) > Created an attachment (id=119283) [edit] > banshee svn crash log > > just tried svn version (r4600) configured with --prefix=/home/onip/mybanshee > --exec-prefix=/home/onip/mybanshee > > my mtp device (Creative Zen Xtra) is recognized, songs are scanned (it takes > 100% cpu...) and at the end of scanning banshee crashes > > (IMHO this log i'm posting won't be usefull, but you know best) Can you install -debug packages for libmtp? That should help fill in some of those ??s. Does this happen consistently - every time? Can you run banshee with banshee-1 --debug --redirect-log, too?
I'm on a gentoo box, so recompiled libmtp with CFLAGS="-O1 -march=i686 -g -ggdb" CXXFLAGS="${CFLAGS}" LDFLAGS="-Wl,-O1" FEATURES="nostrip" but the backtrace is the same as the posted one. should I recompile something else? p.s. ./banshee-1 --debug --redirect-log produces no output, am i missing something?
libmtp 0.3.1 doesn't work on gentoo also for mae. Try 0.3.0.
(In reply to comment #32) > libmtp 0.3.1 doesn't work on gentoo also for mae. > Try 0.3.0. > noway, reemerged libmtp-0.3.0 and rebuilded banshee from svn. crash happens again. I have n songs in my device, spinner goes fast to n-1 than hangs and banshee starts eating cpu. after some time ( 2 - 3 minutes ) it poorly crashes.
For me it does thesame, except it doesn't crash, it just starts working after two minutes;)
*** Bug 568726 has been marked as a duplicate of this bug. ***
*** Bug 554526 has been marked as a duplicate of this bug. ***
*** Bug 557935 has been marked as a duplicate of this bug. ***
*** Bug 559826 has been marked as a duplicate of this bug. ***
OK, sorry this hasn't seen the attention it deserves until now. There are two variants of the bug I've seen in all the dupes - one segfaulting loading Playlists and the other Folders - but they're identical except for that detail, so the fix will be identical, so I'm going to track/fix them as one. Here they are: ... at (wrapper unknown) Mtp.PlaylistStruct.PtrToStructure (intptr,object) <0xffffffff> ... at Mtp.MtpDevice.GetPlaylists () [0x00017] in /home/bartek/rpmbuild/BUILD/banshee-1-1.3.3/src/Libraries/Mtp/Mtp/MtpDevice.cs:194 at Banshee.Dap.Mtp.MtpSource.LoadFromDevice () [0x000cb] in and ... at (wrapper unknown) Mtp.FolderStruct.PtrToStructure (intptr,object)<0xffffffff> ... at Mtp.Folder.GetRootFolders (Mtp.MtpDevice) <0x00072> at Mtp.MtpDevice.GetRootFolders () <0x0000a> at Mtp.MtpDevice.SetDefaultFolders () <0x0001e> at Mtp.MtpDevice..ctor (Mtp.MtpDeviceHandle,Mtp.MtpDeviceStruct) <0x00039> at Mtp.MtpDevice..ctor (intptr,bool,Mtp.MtpDeviceStruct) <0x0004b> at Mtp.MtpDevice.Detect () <0x000c3> at Banshee.Dap.Mtp.MtpSource.DeviceInitialize (Banshee.Hardware.IDevice)
OK, I found a MTP device I can reproduce this on. Crashes with libmtp8 but not with libmtp7. Digging...
Removed libmtp7, reinstalled libmtp8 (0.3.4-3.1 (x86_64) on openSUSE 11.0) - it crashes again.
OK, the patch to make us work with libmtp8 didn't fix the Playlist struct. Since we didn't have playlist support for MTP devices at that time, it didn't come out to bite us until later. I'm not sure why people are seeing the Folder crash, though - that struct looks to match just fine. Anybody still seeing this crash w/ a mention of FolderStruct in the log?
2009-01-29 Gabriel Burt <gabriel.burt@gmail.com> * src/Libraries/Mtp/Mtp/File.cs: * src/Libraries/Mtp/Mtp/Playlist.cs: * src/Libraries/Mtp/Mtp/Track.cs: Fix up the libmtp8 support which was crashing on loading MTP devices due to playlists (BGO #542117, BNC #470722) Fixed in trunk.
*** Bug 566401 has been marked as a duplicate of this bug. ***
*** Bug 571293 has been marked as a duplicate of this bug. ***
*** Bug 564492 has been marked as a duplicate of this bug. ***
*** Bug 560975 has been marked as a duplicate of this bug. ***