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 542117 - Banshee crashes when inserting mtp device (using libmtp8)
Banshee crashes when inserting mtp device (using libmtp8)
Status: RESOLVED FIXED
Product: banshee
Classification: Other
Component: Device - MTP
git master
Other Linux
: High major
: 1.4
Assigned To: Gabriel Burt
Patrick van Staveren
: 554526 557935 559826 560975 564492 566401 568726 571293 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2008-07-08 22:03 UTC by Mieszko Ślusarczyk
Modified: 2009-06-02 22:21 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch for changed API in libmtp by Salah Coronya. (3.12 KB, patch)
2008-09-02 08:36 UTC, Mieszko Ślusarczyk
none Details | Review
Debug log with 0.3.1 (49.70 KB, text/plain)
2008-09-02 10:57 UTC, Michael Monreal
  Details
Update to the previous patch. "Works for me" (4.13 KB, patch)
2008-09-03 07:49 UTC, Mieszko Ślusarczyk
needs-work Details | Review
Debug log with 0.3.1 and latest patch (38.99 KB, text/plain)
2008-09-03 10:30 UTC, Michael Monreal
  Details
Debug log for transferring files to Zen Vision:M using libmtp 0.3.0 (16.28 KB, text/plain)
2008-09-04 16:43 UTC, Mieszko Ślusarczyk
  Details
New version of libmt8 patch (4.54 KB, patch)
2008-09-10 09:42 UTC, Mieszko Ślusarczyk
none Details | Review
Patch to fix compile against mtp-0.3 against HEAD (5.01 KB, patch)
2008-09-10 22:12 UTC, Salah Coronya
committed Details | Review
banshee svn crash log (8.15 KB, text/plain)
2008-09-24 08:58 UTC, onip
  Details

Description Mieszko Ślusarczyk 2008-07-08 22:03:49 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]
Comment 1 Mieszko Ślusarczyk 2008-09-01 09:57:08 UTC
Bump.
Banshee doesn't work with libmtp 0.3.* at all.
Comment 2 Mieszko Ślusarczyk 2008-09-02 08:36:23 UTC
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.
Comment 3 Michael Monreal 2008-09-02 09:06:40 UTC
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.
Comment 4 Mieszko Ślusarczyk 2008-09-02 09:14:07 UTC
(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?
Comment 5 Michael Monreal 2008-09-02 10:38:03 UTC
Sure, what do you need exactly? I mean, debug output with libmtp 0.2.6, 0.3.0 or 0.3.1?
Comment 6 Mieszko Ślusarczyk 2008-09-02 10:47:13 UTC
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.
Comment 7 Michael Monreal 2008-09-02 10:57:20 UTC
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.
Comment 8 Mieszko Ślusarczyk 2008-09-03 07:49:56 UTC
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;)
Comment 9 Michael Monreal 2008-09-03 10:30:06 UTC
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.
Comment 10 Mieszko Ślusarczyk 2008-09-03 15:08:38 UTC
Have you tried with both libmtp 0.3.0 and 0.3.1?
I had problems with the latest.
Comment 11 Michael Monreal 2008-09-03 15:56:58 UTC
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?
Comment 12 Bertrand Lorentz 2008-09-03 20:00:38 UTC
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.
Comment 13 Mieszko Ślusarczyk 2008-09-03 20:09:25 UTC
Yes, of course.
Rhythmbox guys have already tweaked their configure script, so why wait;)
Comment 14 Michael Monreal 2008-09-03 21:06:13 UTC
Also, it's save to assume that the next round of distributions will all ship mtp 0.3.x
Comment 15 Mieszko Ślusarczyk 2008-09-03 21:11:39 UTC
But the developers can also make it detect libmtp version and adapt to it, like rhythmbox devs did.
Comment 16 Mieszko Ślusarczyk 2008-09-04 16:43:43 UTC
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)
Comment 17 Mieszko Ślusarczyk 2008-09-06 08:24:31 UTC
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....
Comment 18 Gabriel Burt 2008-09-09 23:40:42 UTC
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.
Comment 19 Mieszko Ślusarczyk 2008-09-10 05:14:59 UTC
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
Comment 20 Mieszko Ślusarczyk 2008-09-10 09:42:03 UTC
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.
Comment 21 Salah Coronya 2008-09-10 22:12:56 UTC
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.
Comment 22 Gabriel Burt 2008-09-22 20:57:19 UTC
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.
Comment 23 Mieszko Ślusarczyk 2008-09-22 21:34:50 UTC
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?
Comment 24 Gabriel Burt 2008-09-22 21:38:53 UTC
Both of those are possible, but neither are how I'd like to see it done.
Comment 25 Gabriel Burt 2008-09-23 19:29:41 UTC
I'm working on the compatibility, using #if preprocessor directives to, as Mieszko was suggesting, only patch the files for libmtp8 support as appropriate.
Comment 26 Gabriel Burt 2008-09-23 20:39:50 UTC
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!
Comment 27 onip 2008-09-24 08:58:27 UTC
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)
Comment 28 Michael Monreal 2008-09-24 10:35:26 UTC
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.
Comment 29 onip 2008-09-24 11:58:48 UTC
mtp-0.3.1
Comment 30 Gabriel Burt 2008-09-24 14:29:57 UTC
(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?
Comment 31 onip 2008-09-24 15:43:52 UTC
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?
Comment 32 Mieszko Ślusarczyk 2008-09-24 17:56:38 UTC
libmtp 0.3.1 doesn't work on gentoo also for mae.
Try 0.3.0.
Comment 33 onip 2008-09-25 07:22:36 UTC
(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.
Comment 34 Mieszko Ślusarczyk 2008-09-25 08:22:09 UTC
For me it does thesame, except it doesn't crash, it just starts working after two minutes;)
Comment 35 Gabriel Burt 2009-01-30 00:13:38 UTC
*** Bug 568726 has been marked as a duplicate of this bug. ***
Comment 36 Gabriel Burt 2009-01-30 00:14:22 UTC
*** Bug 554526 has been marked as a duplicate of this bug. ***
Comment 37 Gabriel Burt 2009-01-30 00:17:30 UTC
*** Bug 557935 has been marked as a duplicate of this bug. ***
Comment 38 Gabriel Burt 2009-01-30 00:17:50 UTC
*** Bug 559826 has been marked as a duplicate of this bug. ***
Comment 39 Gabriel Burt 2009-01-30 00:22:20 UTC
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)
Comment 40 Gabriel Burt 2009-01-30 00:40:00 UTC
OK, I found a MTP device I can reproduce this on.  Crashes with libmtp8 but not with libmtp7.  Digging...
Comment 41 Gabriel Burt 2009-01-30 00:46:42 UTC
Removed libmtp7, reinstalled libmtp8 (0.3.4-3.1  (x86_64) on openSUSE 11.0) - it crashes again.
Comment 42 Gabriel Burt 2009-01-30 01:01:31 UTC
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?
Comment 43 Gabriel Burt 2009-01-30 02:26:25 UTC
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.
Comment 44 Gabriel Burt 2009-02-03 21:12:18 UTC
*** Bug 566401 has been marked as a duplicate of this bug. ***
Comment 45 Gabriel Burt 2009-02-12 01:03:09 UTC
*** Bug 571293 has been marked as a duplicate of this bug. ***
Comment 46 Gabriel Burt 2009-02-13 03:08:13 UTC
*** Bug 564492 has been marked as a duplicate of this bug. ***
Comment 47 Gabriel Burt 2009-06-02 22:21:56 UTC
*** Bug 560975 has been marked as a duplicate of this bug. ***