android-file-transfer-linux icon indicating copy to clipboard operation
android-file-transfer-linux copied to clipboard

Slowdown and crash when uploading files to Huawei P30 Lite

Open iDarkTemplar opened this issue 4 years ago • 6 comments

When uploading a lot of files to huawei p30 lite android-file-transfer GUI application starts slowing down, eventually hitting timeouts and crashing. It starts with approximately 20MB/s write speed and eventually drops to 6MB/s, and after some more time it crashes.

Reproduces both on 4.2 and current master (commit 4687cf4)

Parts of gdb log with partial debuginfo
$ gdb $(which android-file-transfer)
GNU gdb (Gentoo 10.2 vanilla) 10.2
Copyright (C) 2021 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-pc-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://bugs.gentoo.org/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /usr/bin/android-file-transfer...
Reading symbols from /usr/lib/debug//usr/bin/android-file-transfer.debug...
(gdb) run
Starting program: /usr/bin/android-file-transfer 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
[New Thread 0x7ffff324d640 (LWP 13787)]
[New Thread 0x7fffebfff640 (LWP 13788)]
upload worker started
[New Thread 0x7fffeadee640 (LWP 13790)]
[New Thread 0x7fffea016640 (LWP 13791)]
[New Thread 0x7fffe9815640 (LWP 13792)]
[New Thread 0x7fffe9014640 (LWP 13793)]
[New Thread 0x7fffe8813640 (LWP 13794)]
current text color value:  31 , guessed theme:  "light"
scan
probing device...
probing device...
probing device...
device found, opening session...
device info "HUAWEI"   "MAR-LX1M"
mtpz-data path:  "/home/user/.mtpz-data"
switching to storage id  65537
session opened, starting
qt.qpa.xcb: QXcbConnection: XCB error: 3 (BadWindow), sequence: 3914, resource id: 27263194, major code: 40 (TranslateCoords), minor code: 0

...

sending  8262638  bytes
new object id:  74 , sending...
30029 ms since the last poll call
failed to send new object info  "timeout reaping usb urb"
uploading file  "/fullpath/file75" , parent:  "/fullpath"
uploadFile  "file75"  as  "file75"
sending  7547436  bytes
got unknown urb: 0x7fffeaded2f0 of size -603947874
10008 ms since the last poll call
failed to send new object info  "timeout reaping usb urb"
uploading file  "/fullpath/file76" , parent:  "/fullpath"
uploadFile  "file76"  as  "file76"
sending  8084413  bytes
10010 ms since the last poll call
failed to send new object info  "timeout reaping usb urb"
uploading file  "/fullpath/file77" , parent:  "/fullpath"
uploadFile  "file77"  as  "file77"
sending  14233918  bytes
got unknown urb: 0x7fffeaded240 of size -354495872
10010 ms since the last poll call

Thread 4 "QThread" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fffeadee640 (LWP 13790)]
0x00007ffff6958647 in ?? () from /usr/lib/gcc/x86_64-pc-linux-gnu/10.3.0/libgcc_s.so.1
(gdb) bt
#0  0x00007ffff6958647 in ?? () from /usr/lib/gcc/x86_64-pc-linux-gnu/10.3.0/libgcc_s.so.1
#1  0x00007ffff6959b43 in _Unwind_RaiseException () from /usr/lib/gcc/x86_64-pc-linux-gnu/10.3.0/libgcc_s.so.1
#2  0x00007ffff695a125 in _Unwind_Resume_or_Rethrow () from /usr/lib/gcc/x86_64-pc-linux-gnu/10.3.0/libgcc_s.so.1
#3  0x00007ffff6a0b8f8 in __cxa_rethrow () from /usr/lib/gcc/x86_64-pc-linux-gnu/10.3.0/libstdc++.so.6
#4  0x00007ffff76d5451 in mtp::usb::Device::Submit (this=0x555555895340, urb=0x7fffeaded1d0, timeout=10000)
    at /var/tmp/portage/sys-fs/android-file-transfer-linux-4.2/work/android-file-transfer-linux-4.2/mtp/backend/linux/usb/Device.cpp:292
#5  0x00007ffff770da67 in mtp::usb::Device::WriteBulk (this=0x555555895340, ep=..., inputStream=std::shared_ptr<mtp::IObjectInputStream> (use count 2, weak count 0) = {...}, timeout=10000)
    at /var/tmp/portage/sys-fs/android-file-transfer-linux-4.2/work/android-file-transfer-linux-4.2/mtp/backend/linux/usb/Device.cpp:321
#6  0x00007fff00000000 in ?? ()
#7  0x0000000000000008 in ?? ()
#8  0x000055555579be60 in ?? ()
#9  0x00007fffdc107a40 in ?? ()
#10 0x00007fffdc107a30 in ?? ()
#11 0x0000000300000008 in ?? ()
#12 0xbf66462292399e00 in ?? ()
#13 0x00007fffeaded340 in ?? ()
#14 0x00007fffdc107a30 in ?? ()
#15 0x0000555555dfea90 in ?? ()
#16 0x0000000000002710 in ?? ()
#17 0x0000000000000014 in ?? ()
#18 0x0000000000000014 in ?? ()
#19 0x00007fffeaded450 in ?? ()
#20 0x00007ffff76e8849 in mtp::PipePacketer::Write (this=0xfffffffedc107a30, this@entry=0x555555dfea90, data=std::vector of length 20, capacity 512 = {...}, timeout=-354495776, timeout@entry=10000)
    at /var/tmp/portage/sys-fs/android-file-transfer-linux-4.2/work/android-file-transfer-linux-4.2/mtp/ptp/PipePacketer.cpp:41
#21 0x00007ffff76ec7de in mtp::Session::Send (packeter=..., req=..., timeout=10000) at /var/tmp/portage/sys-fs/android-file-transfer-linux-4.2/work/android-file-transfer-linux-4.2/mtp/ptp/Session.cpp:91
#22 0x00007ffff76ee998 in mtp::Session::SendObjectInfo (this=0x555555dfea40, objectInfo=..., storageId=..., parentObject=parentObject@entry=...)
    at /var/tmp/portage/sys-fs/android-file-transfer-linux-4.2/work/android-file-transfer-linux-4.2/mtp/ptp/Session.cpp:293
#23 0x0000555555592721 in MtpObjectsModel::uploadFile (this=0x5555556e69c0, parentObjectId=..., filePath=..., filename=...)
    at /var/tmp/portage/sys-fs/android-file-transfer-linux-4.2/work/android-file-transfer-linux-4.2/qt/mtpobjectsmodel.cpp:304
#24 0x000055555558aaca in CommandQueue::uploadFile (this=0x5555557135b0, filename=...) at /var/tmp/portage/sys-fs/android-file-transfer-linux-4.2/work/android-file-transfer-linux-4.2/qt/commandqueue.cpp:130
#25 0x00005555555869f8 in CommandQueue::execute (this=<optimized out>, ptr=0x5555562c3a50) at /var/tmp/portage/sys-fs/android-file-transfer-linux-4.2/work/android-file-transfer-linux-4.2/qt/commandqueue.cpp:277
#26 0x00007ffff6dfc462 in QObject::event(QEvent*) () from /usr/lib64/libQt5Core.so.5
#27 0x00007ffff7a5b1bf in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib64/libQt5Widgets.so.5
#28 0x00007ffff7a63e30 in QApplication::notify(QObject*, QEvent*) () from /usr/lib64/libQt5Widgets.so.5
#29 0x00007ffff6dd1a28 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () from /usr/lib64/libQt5Core.so.5
#30 0x00007ffff6dd4eca in QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) () from /usr/lib64/libQt5Core.so.5
#31 0x00007ffff6e22ad3 in ?? () from /usr/lib64/libQt5Core.so.5
#32 0x00007ffff5a66b4b in g_main_context_dispatch () from /usr/lib64/libglib-2.0.so.0
#33 0x00007ffff5a66df8 in ?? () from /usr/lib64/libglib-2.0.so.0
#34 0x00007ffff5a66eaf in g_main_context_iteration () from /usr/lib64/libglib-2.0.so.0
#35 0x00007ffff6e2258a in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib64/libQt5Core.so.5
#36 0x00007ffff6dd04e3 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib64/libQt5Core.so.5
#37 0x00007ffff6c24397 in QThread::exec() () from /usr/lib64/libQt5Core.so.5
#38 0x00007ffff6c254e5 in ?? () from /usr/lib64/libQt5Core.so.5
#39 0x00007ffff62cde3e in start_thread (arg=0x7fffeadee640) at pthread_create.c:481
#40 0x00007ffff68862cf in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

iDarkTemplar avatar Jul 19 '21 12:07 iDarkTemplar

It looks like AFTL struggles to create ObjectInfo in time :thinking:

If you're able to build it from source, could you try replacing in mtp/ptp/Session.cpp:293:

Send(OperationRequest(OperationCode::SendObjectInfo, transaction.Id, storageId.Id, parentObject.Id));

with

Send(OperationRequest(OperationCode::SendObjectInfo, transaction.Id, storageId.Id, parentObject.Id), LongTimeout);

whoozle avatar Jul 21 '21 07:07 whoozle

It didn't help to fix this issue for me. Crash looks same, but maybe it happens just a bit later.

backtrace
Thread 4 "QThread" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fffeadee640 (LWP 14059)]
0x00007ffff6958647 in ?? () from /usr/lib/gcc/x86_64-pc-linux-gnu/10.3.0/libgcc_s.so.1
(gdb) bt
#0  0x00007ffff6958647 in ?? () from /usr/lib/gcc/x86_64-pc-linux-gnu/10.3.0/libgcc_s.so.1
#1  0x00007ffff6959b43 in _Unwind_RaiseException () from /usr/lib/gcc/x86_64-pc-linux-gnu/10.3.0/libgcc_s.so.1
#2  0x00007ffff695a125 in _Unwind_Resume_or_Rethrow () from /usr/lib/gcc/x86_64-pc-linux-gnu/10.3.0/libgcc_s.so.1
#3  0x00007ffff6a0b8f8 in __cxa_rethrow () from /usr/lib/gcc/x86_64-pc-linux-gnu/10.3.0/libstdc++.so.6
#4  0x00007ffff76d5451 in mtp::usb::Device::Submit (this=0x5555558874b0, urb=0x7fffeaded1d0, timeout=30000)
    at /var/tmp/portage/sys-fs/android-file-transfer-linux-9999/work/android-file-transfer-linux-9999/mtp/backend/linux/usb/Device.cpp:292
#5  0x00007ffff770da67 in mtp::usb::Device::WriteBulk (this=0x5555558874b0, ep=..., inputStream=std::shared_ptr<mtp::IObjectInputStream> (use count 2, weak count 0) = {...}, timeout=30000)
    at /var/tmp/portage/sys-fs/android-file-transfer-linux-9999/work/android-file-transfer-linux-9999/mtp/backend/linux/usb/Device.cpp:321
#6  0x00007fff00000000 in ?? ()
#7  0x0000000000000008 in ?? ()
#8  0x000055555584ec80 in ?? ()
#9  0x00007fffdc107f50 in ?? ()
#10 0x00007fffdc107f40 in ?? ()
#11 0x0000000300000008 in ?? ()
#12 0xf8d909aacbe1f000 in ?? ()
#13 0x00007fffeaded340 in ?? ()
#14 0x00007fffdc107f40 in ?? ()
#15 0x0000555555e17d70 in ?? ()
#16 0x0000000000007530 in ?? ()
#17 0x0000000000000014 in ?? ()
#18 0x0000000000000014 in ?? ()
#19 0x00007fffeaded450 in ?? ()
#20 0x00007ffff76e8849 in mtp::PipePacketer::Write (this=0xfffffffedc107f40, this@entry=0x555555e17d70, data=std::vector of length 20, capacity 512 = {...}, timeout=-354495776, timeout@entry=30000)
    at /var/tmp/portage/sys-fs/android-file-transfer-linux-9999/work/android-file-transfer-linux-9999/mtp/ptp/PipePacketer.cpp:41
#21 0x00007ffff76ec7de in mtp::Session::Send (packeter=..., req=..., timeout=30000) at /var/tmp/portage/sys-fs/android-file-transfer-linux-9999/work/android-file-transfer-linux-9999/mtp/ptp/Session.cpp:91
#22 0x00007ffff76ee99b in mtp::Session::SendObjectInfo (this=0x555555e17d20, objectInfo=..., storageId=..., parentObject=parentObject@entry=...)
    at /var/tmp/portage/sys-fs/android-file-transfer-linux-9999/work/android-file-transfer-linux-9999/mtp/ptp/Session.cpp:293
#23 0x0000555555592721 in MtpObjectsModel::uploadFile (this=0x5555556e88e0, parentObjectId=..., filePath=..., filename=...)
    at /var/tmp/portage/sys-fs/android-file-transfer-linux-9999/work/android-file-transfer-linux-9999/qt/mtpobjectsmodel.cpp:304
#24 0x000055555558aaca in CommandQueue::uploadFile (this=0x5555556ebe80, filename=...) at /var/tmp/portage/sys-fs/android-file-transfer-linux-9999/work/android-file-transfer-linux-9999/qt/commandqueue.cpp:130
#25 0x00005555555869f8 in CommandQueue::execute (this=<optimized out>, ptr=0x55555623a360) at /var/tmp/portage/sys-fs/android-file-transfer-linux-9999/work/android-file-transfer-linux-9999/qt/commandqueue.cpp:277
#26 0x00007ffff6dfc462 in QObject::event(QEvent*) () from /usr/lib64/libQt5Core.so.5
#27 0x00007ffff7a5b1bf in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib64/libQt5Widgets.so.5
#28 0x00007ffff7a63e30 in QApplication::notify(QObject*, QEvent*) () from /usr/lib64/libQt5Widgets.so.5
#29 0x00007ffff6dd1a28 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () from /usr/lib64/libQt5Core.so.5
#30 0x00007ffff6dd4eca in QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) () from /usr/lib64/libQt5Core.so.5
#31 0x00007ffff6e22ad3 in ?? () from /usr/lib64/libQt5Core.so.5
#32 0x00007ffff5a66b4b in g_main_context_dispatch () from /usr/lib64/libglib-2.0.so.0
#33 0x00007ffff5a66df8 in ?? () from /usr/lib64/libglib-2.0.so.0
#34 0x00007ffff5a66eaf in g_main_context_iteration () from /usr/lib64/libglib-2.0.so.0
#35 0x00007ffff6e2258a in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib64/libQt5Core.so.5
#36 0x00007ffff6dd04e3 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib64/libQt5Core.so.5
#37 0x00007ffff6c24397 in QThread::exec() () from /usr/lib64/libQt5Core.so.5
#38 0x00007ffff6c254e5 in ?? () from /usr/lib64/libQt5Core.so.5
#39 0x00007ffff62cde3e in start_thread (arg=0x7fffeadee640) at pthread_create.c:481
#40 0x00007ffff68862cf in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

iDarkTemplar avatar Jul 21 '21 09:07 iDarkTemplar

Thanks, how many files do you upload? what are their sizes? I'll try to recreate on one of the slower devices.

whoozle avatar Jul 21 '21 10:07 whoozle

129 files, 1 directory with 3 subdirectories, total size 2.7GB. File sizes vary from 2MB up to 70MB.

iDarkTemplar avatar Jul 21 '21 10:07 iDarkTemplar

What are file types? Pictures or just binary files? Why I'm asking is that maybe it tries to generate thumbnail entry along with file entry.

Also what is your android version and host linux kernel version please?

whoozle avatar Jul 21 '21 10:07 whoozle

Files are flac (corrected: music with lossless compression), except for 2 jpg pictures (200 KB and 1.5MB) and 1 pdf file (33MB).

Android 10 (EMUI 10.0.0.465, kernel 4.14.116), host linux kernel sys-kernel/gentoo-sources-5.10.52.

iDarkTemplar avatar Jul 21 '21 10:07 iDarkTemplar