gvfs-mtp backend crashes on plug/unplug/unlock of Android phone, file transfer to Android phone does not work
@till.kamppeter
Submitted by Till Kamppeter Assigned to Philip Langdale
Link to original bug (#789150)
Description
I am Using Ubuntu 17.10 (Artful) with GNOME desktop (default in this Ubuntu version). I have connected an Android phone (Samsung Galaxy Note 3 or Motorola Z2 Play) to USB and want to transfer MP3 music files from the computer to the phone.
For several weeks already I have observed crashes of gvfs-mtp, one on each day where I have connected the phone to USB simply to charge the battery. As Ubuntu's crash reporter only pops up the message after a certain delay I am not sure whether the crash was caused by plugging, unplugging, or unlocking the device (there is already a bug reported here in Bugzilla for a crash on unplug: bug 787992).
The crash reports in Ubuntu generated this bug report and its duplicates:
https://bugs.launchpad.net/ubuntu/+source/gvfs/+bug/1706097
The reports have threaded backtraces attached. Crash happens in unregister_mount_got_proxy_cb(), so most probably they are bug 787992.
Yesterday I have tried to transfer MP3 music files to the mentioned phones using Rhythmbox, which did not work. Rhythmbox complained that it could not write to the phone.
Then I got the hint to run gvfsd-mtp through valgrind to avoid it crashing. For that I have done
sudo mv /usr/lib/gvfs/gvfsd-mtp /usr/lib/gvfs/gvfsd-mtp.bin
and created a new executable file /usr/lib/gvfs/gvfsd-mtp containing
#!/bin/sh export G_SLICE=always-malloc G_DEBUG=gc-friendly valgrind -v --tool=memcheck --leak-check=no --log-file=/tmp/gvfs.%p /usr/lib/gvfs/gvfsd-mtp.bin $@
Now there are no automatic crash reports on gvfsd-mtp any more, but once I got the following automatic crash report:
https://bugs.launchpad.net/bugs/1724323
File transfer still does not work. With the phone connected and its screen unlocked Rhythmbox gives the message "Error transferring track, Could not open resource for writing.".
A log file of the wrapper script shown above is pasted below (all debug symbol packages installed and gvfsd-mtp.bin replaced by unstripped version).
==3653== Memcheck, a memory error detector ==3653== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al. ==3653== Using Valgrind-3.13.0 and LibVEX; rerun with -h for copyright info ==3653== Command: /usr/lib/gvfs/gvfsd-mtp.bin --spawner :1.22 /org/gtk/gvfs/exec_spaw/0 ==3653== Parent PID: 3652 ==3653== --3653-- --3653-- Valgrind options: --3653-- -v --3653-- --tool=memcheck --3653-- --leak-check=no --3653-- --log-file=/tmp/gvfs.%p --3653-- Contents of /proc/version: --3653-- Linux version 4.13.0-16-generic (buildd@lcy01-02) (gcc version 7.2.0 (Ubuntu 7.2.0-8ubuntu2)) #19-Ubuntu SMP Wed Oct 11 18:35:14 UTC 2017 --3653-- --3653-- Arch and hwcaps: AMD64, LittleEndian, amd64-cx16-lzcnt-rdtscp-sse3-avx-avx2-bmi --3653-- Page sizes: currently 4096, max supported 4096 --3653-- Valgrind library directory: /usr/lib/valgrind --3653-- Reading syms from /usr/lib/gvfs/gvfsd-mtp.bin --3653-- Reading syms from /lib/x86_64-linux-gnu/ld-2.26.so --3653-- Considering /lib/x86_64-linux-gnu/ld-2.26.so .. --3653-- .. CRC mismatch (computed 8e133c77 wanted 4706bdfa) --3653-- Considering /usr/lib/debug/lib/x86_64-linux-gnu/ld-2.26.so .. --3653-- .. CRC is valid --3653-- Reading syms from /usr/lib/valgrind/memcheck-amd64-linux --3653-- Considering /usr/lib/valgrind/memcheck-amd64-linux .. --3653-- .. CRC mismatch (computed eb774b19 wanted 9c8eee1f) --3653-- object doesn't have a symbol table --3653-- object doesn't have a dynamic symbol table --3653-- Scheduler: using generic scheduler lock implementation. --3653-- Reading suppressions file: /usr/lib/valgrind/default.supp ==3653== embedded gdbserver: reading from /tmp/vgdb-pipe-from-vgdb-to-3653-by-till-on-??? ==3653== embedded gdbserver: writing to /tmp/vgdb-pipe-to-vgdb-from-3653-by-till-on-??? ==3653== embedded gdbserver: shared mem /tmp/vgdb-pipe-shared-mem-vgdb-3653-by-till-on-??? ==3653== ==3653== TO CONTROL THIS PROCESS USING vgdb (which you probably ==3653== don't want to do, unless you know exactly what you're doing, ==3653== or are doing some strange experiment): ==3653== /usr/lib/valgrind/../../bin/vgdb --pid=3653 ...command... ==3653== ==3653== TO DEBUG THIS PROCESS USING GDB: start GDB like this ==3653== /path/to/gdb /usr/lib/gvfs/gvfsd-mtp.bin ==3653== and then give GDB the following command ==3653== target remote | /usr/lib/valgrind/../../bin/vgdb --pid=3653 ==3653== --pid is optional if only one valgrind process is running ==3653== --3653-- REDIR: 0x401f7b0 (ld-linux-x86-64.so.2:strlen) redirected to 0x58060901 (???) --3653-- REDIR: 0x401f590 (ld-linux-x86-64.so.2:index) redirected to 0x5806091b (???) --3653-- Reading syms from /usr/lib/valgrind/vgpreload_core-amd64-linux.so --3653-- Considering /usr/lib/valgrind/vgpreload_core-amd64-linux.so .. --3653-- .. CRC mismatch (computed 03b2196b wanted a4aa32fd) --3653-- object doesn't have a symbol table --3653-- Reading syms from /usr/lib/valgrind/vgpreload_memcheck-amd64
Version: 1.34.x