Bug 473071

Summary: kdeconnectd crashes during file transfter from android mobile via wifi with the message "kdeconnectd[21413]: Fatal Error: Got cmd 100, while waiting for an answer!"
Product: [Applications] kdeconnect Reporter: Prasad Murthy <phoenix_firebrd>
Component: commonAssignee: Albert Vaca Cintora <albertvaka>
Status: RESOLVED DUPLICATE    
Severity: crash CC: andrew.g.r.holmes, cwo.kde, jaggz.h, kdedev
Priority: NOR    
Version First Reported In: 23.08.4   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Prasad Murthy 2023-08-06 11:56:04 UTC
kdeconnect version:  23.04.3-0xneon+22.04+jammy+release+build31

System Info
--------------------------------------------------------------------------------------
Operating System: KDE neon 5.27
KDE Plasma Version: 5.27.7
KDE Frameworks Version: 5.108.0
Qt Version: 5.15.10
Kernel Version: 6.4.7 (64-bit)
Graphics Platform: X11
Processors: 32 × AMD Ryzen 9 7950X 16-Core Processor
Memory: 31.1 GiB of RAM
Graphics Processor: NVIDIA GeForce RTX 3060 Ti/PCIe/SSE2
Manufacturer: ASUS
----------------------------------------------------------------------------------------
Note: This happens randomly with kdeconnect while transferring multiple files from android mobile to PC but frequently
----------------------------------------------------------------------------------------
Backtrace
----------------------------------------------------------------------------------------
gdb /usr/lib/x86_64-linux-gnu/libexec/kdeconnectd
GNU gdb (Ubuntu 12.1-0ubuntu1~22.04) 12.1
Copyright (C) 2022 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-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
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/lib/x86_64-linux-gnu/libexec/kdeconnectd...
Reading symbols from /usr/lib/debug/.build-id/87/c3f5bc008ff6e2e5005e53779a1a20aea7b45a.debug...
(gdb) run
Starting program: /usr/lib/x86_64-linux-gnu/libexec/kdeconnectd 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7ffff17b1640 (LWP 22394)]
[New Thread 0x7ffff0fb0640 (LWP 22395)]
[New Thread 0x7fffe07ff640 (LWP 22396)]
[New Thread 0x7fffdff53640 (LWP 22397)]
Connecting to deprecated signal QDBusConnectionInterface::serviceOwnerChanged(QString,QString,QString)
kdeconnect.plugin.battery: No Primary Battery detected on this system. This may be a bug.
kdeconnect.plugin.battery: Total quantity of batteries found:  4
[Detaching after fork from child process 22398]
org.kde.pulseaudio: No object for name "bluez_output.74_45_CE_5A_2B_62.1.monitor"
kdeconnect.plugin.battery: No Primary Battery detected on this system. This may be a bug.
kdeconnect.plugin.battery: Total quantity of batteries found:  4
[New Thread 0x7fffdf5a0640 (LWP 22405)]
Fatal Error: Got cmd 100, while waiting for an answer!

Thread 6 "KIO::WorkerThre" received signal SIGABRT, Aborted.
[Switching to Thread 0x7fffdf5a0640 (LWP 22405)]
__pthread_kill_implementation (no_tid=0, signo=6, threadid=140736940607040) at ./nptl/pthread_kill.c:44
44      ./nptl/pthread_kill.c: No such file or directory.
(gdb) bt
#0  __pthread_kill_implementation (no_tid=0, signo=6, threadid=140736940607040) at ./nptl/pthread_kill.c:44
#1  __pthread_kill_internal (signo=6, threadid=140736940607040) at ./nptl/pthread_kill.c:78
#2  __GI___pthread_kill (threadid=140736940607040, signo=signo@entry=6) at ./nptl/pthread_kill.c:89
#3  0x00007ffff5c42476 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
#4  0x00007ffff5c287f3 in __GI_abort () at ./stdlib/abort.c:79
#5  0x00007ffff6491ba3 in qt_message_fatal (message=<synthetic pointer>..., context=...) at global/qlogging.cpp:1919
#6  QMessageLogger::fatal (this=this@entry=0x7fffdf59f670, msg=msg@entry=0x7ffff7d2fcd8 "Fatal Error: Got cmd %d, while waiting for an answer!") at global/qlogging.cpp:898
#7  0x00007ffff7c1c5b8 in KIO::SlaveBase::waitForAnswer (this=0x7fffcc004de0, expected1=84, expected2=65, data=..., pCmd=0x7fffdf59f6e4) at ./src/core/slavebase.cpp:1149
#8  0x00007ffff7c655c5 in KIO::SlaveBase::canResume (this=this@entry=0x7fffcc004de0, offset=65536) at ./src/core/slavebase.cpp:1116
#9  0x00007fffdf5af68f in FileProtocol::put (this=0x7fffcc004dd0, url=..., _mode=-1, _flags=...) at ./src/ioslaves/file/file.cpp:550
#10 0x00007ffff7c6aa5a in KIO::SlaveBase::dispatch (this=0x7fffcc004de0, command=68, data=...) at ./src/core/slavebase.cpp:1289
#11 0x00007ffff7c6b3f6 in KIO::SlaveBase::dispatchLoop (this=0x7fffcc004de0) at ./src/core/slavebase.cpp:342
#12 0x00007ffff7d06257 in KIO::WorkerThread::run (this=0x555555daa360) at ./src/core/workerthread.cpp:62
#13 0x00007ffff64cebd3 in operator() (__closure=<optimized out>, __closure=<optimized out>) at thread/qthread_unix.cpp:350
#14 (anonymous namespace)::terminate_on_exception<QThreadPrivate::start(void*)::<lambda()> > (t=..., t=...) at thread/qthread_unix.cpp:287
#15 QThreadPrivate::start (arg=0x555555daa360) at thread/qthread_unix.cpp:310
#16 0x00007ffff5c94b43 in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:442
#17 0x00007ffff5d26a00 in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
Comment 1 TraceyC 2024-02-07 02:44:03 UTC
I was able to reproduce this, intermittently
See https://bugs.kde.org/show_bug.cgi?id=418074 

There are a number of bugs related to crashes in kdeconnect if the user atteempts to transfer multiple files, or a large file, from a phone to Plasma. I'm not sure they are all duplicates. I'm listing them here so that someone more knowledgeable can more easily take a look at them as a group.

https://bugs.kde.org/show_bug.cgi?id=418074
https://bugs.kde.org/show_bug.cgi?id=467015
https://bugs.kde.org/show_bug.cgi?id=470273
https://bugs.kde.org/show_bug.cgi?id=471881
https://bugs.kde.org/show_bug.cgi?id=473071
https://bugs.kde.org/show_bug.cgi?id=474495
https://bugs.kde.org/show_bug.cgi?id=475747
https://bugs.kde.org/show_bug.cgi?id=480889

## System details

kdeconnect 23.08.4

Operating System: Solus 4.5
KDE Plasma Version: 5.27.10
KDE Frameworks Version: 5.114.0
Qt Version: 5.15.12
Kernel Version: 6.6.15-272.current (64-bit)
Graphics Platform: X11
Processors: 16 × 11th Gen Intel® Core™ i7-11800H @ 2.30GHz
Memory: 62.5 GiB of RAM
Graphics Processor: NVIDIA GeForce RTX 3060 Laptop GPU/PCIe/SSE2
Manufacturer: Dell Inc.
Product Name: XPS 17 9710

Phone:
Sony Xperia 1 III
Model: SQ-BC62
Android v12 - kdeconnect 1.29.0
Comment 2 Jaggz H. 2024-06-12 05:44:01 UTC
I also get this, and have for years. Highly-repeatable.
Transferring more than a few files, or a large file, will almost certainly result in a "(failed)".
After that, I often end up in a state where the daemon will close unexpectedly with any attempt to transfer a file.

I can kill kdeconnectd and quickly gdb a new one. Upon transfering a file I get a similar result:
```
[New Thread 0x7fffa1bff6c0 (LWP 2900733)]
Connecting to deprecated signal QDBusConnectionInterface::serviceOwnerChanged(QString,QString,QString)
[New Thread 0x7fffa13fe6c0 (LWP 2900734)]
kdeconnect.plugin.battery: No Primary Battery detected on this system. This may be a bug.
kdeconnect.plugin.battery: Total quantity of batteries found:  0
[Detaching after fork from child process 2900742]
discarding unsupported packet "kdeconnect.runcommand.request" for "dogfood"
[New Thread 0x7fffa0bfd6c0 (LWP 2900750)]
Fatal Error: Got cmd 100, while waiting for an answer!

Thread 23 "KIO::WorkerThre" received signal SIGABRT, Aborted.
[Switching to Thread 0x7fffa0bfd6c0 (LWP 2900750)]
__pthread_kill_implementation (threadid=<optimized out>,
signo=signo@entry=6, no_tid=no_tid@entry=0)
at ./nptl/pthread_kill.c:44
44      ./nptl/pthread_kill.c: No such file or directory.
```
(bt output is down below \/)

Operating System: Debian GNU/Linux 12
KDE Plasma Version: 5.27.5
KDE Frameworks Version: 5.103.0
Qt Version: 5.15.8
Kernel Version: 6.1.0-20-amd64 (64-bit)
Graphics Platform: X11
Memory: 31.2 GiB of RAM
Graphics Processor: llvmpipe
Manufacturer: ASUS
Product Name: All Series

```
(gdb) bt
#0  __pthread_kill_implementation (threadid=<optimized out>,
signo=signo@entry=6, no_tid=no_tid@entry=0)
at ./nptl/pthread_kill.c:44
#1  0x00007ffff62a9e8f in __pthread_kill_internal (signo=6,
threadid=<optimized out>) at ./nptl/pthread_kill.c:78
#2  0x00007ffff625afb2 in __GI_raise (sig=sig@entry=6)
at ../sysdeps/posix/raise.c:26
#3  0x00007ffff6245472 in __GI_abort () at ./stdlib/abort.c:79
#4  0x00007ffff6490c79 in QMessageLogger::fatal(char const*, ...) const ()
from /lib/x86_64-linux-gnu/libQt5Core.so.5
#5  0x00007ffff7c413b6 in KIO::SlaveBase::waitForAnswer(int, int, QByteArray&, int*) () from /lib/x86_64-linux-gnu/libKF5KIOCore.so.5
#6  0x00007ffff7c43335 in KIO::SlaveBase::canResume(unsigned long long) ()
from /lib/x86_64-linux-gnu/libKF5KIOCore.so.5
#7  0x00007fffe1c771bd in ?? ()
from /usr/lib/x86_64-linux-gnu/qt5/plugins/kf5/kio/kio_file.so
#8  0x00007ffff7c48a91 in KIO::SlaveBase::dispatch(int, QByteArray const&)
() from /lib/x86_64-linux-gnu/libKF5KIOCore.so.5
#9  0x00007ffff7c493f6 in KIO::SlaveBase::dispatchLoop() ()
from /lib/x86_64-linux-gnu/libKF5KIOCore.so.5
#10 0x00007ffff7ce2a6e in ?? ()
from /lib/x86_64-linux-gnu/libKF5KIOCore.so.5
#11 0x00007ffff64cbd43 in ?? () from /lib/x86_64-linux-gnu/libQt5Core.so.5
#12 0x00007ffff62a8134 in start_thread (arg=<optimized out>)
at ./nptl/pthread_create.c:442
#13 0x00007ffff63287dc in clone3 ()
at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
```
Comment 3 Jaggz H. 2024-06-12 12:14:39 UTC
Okay, I built my own, but am not yet sure how to debug it.
Unfortunately, fresh repos won't build on my system (Debian stable is kded 5.103.0) -- I couldn't get the build system to work with it anyway, so I went back to a checkout of 22.12.  (But, again, the problem's been here for years so it's possibly the same code causing it.)

That version outputs this when I try to send a file to it (which also fails and.. application closed unexpectedly):

Connecting to deprecated signal QDBusConnectionInterface::serviceOwnerChanged(QString,QString,QString/kdeconnect-dev/
kdeconnect.plugin.battery: No Primary Battery detected on this system. This may be a bug.
kdeconnect.plugin.battery: Total quantity of batteries found:  0
Fatal Error: Got cmd 100, while waiting for an answer!
70 -- exe=/home/e/kdeconnect-dev/lib/x86_64-linux-gnu/libexec/kdeconnectd
13 -- platform=xcb
11 -- display=:0
20 -- appname=kdeconnectd
62 -- apppath=/home/e/kdeconnect-dev/lib/x86_64-linux-gnu/libexec
9 -- signal=6
12 -- pid=2222056
19 -- appversion=22.12.3
31 -- programname=KDE Connect Daemon
31 -- bugaddress=submit@bugs.kde.org
KCrash: crashing... crashRecursionCounter = 2
KCrash: Application Name = kdeconnectd path = /home/e/kdeconnect-dev/lib/x86_64-linux-gnu/libexec pid = 2222056
KCrash: Arguments: /home/e/kdeconnect-dev/lib/x86_64-linux-gnu/libexec/kdeconnectd
KCrash: Attempting to start /usr/lib/x86_64-linux-gnu/libexec/drkonqi
QSocketNotifier: Invalid socket 6 and type 'Read', disabling...
QSocketNotifier: Invalid socket 12 and type 'Read', disabling...
QSocketNotifier: Invalid socket 13 and type 'Read', disabling...
QSocketNotifier: Invalid socket 17 and type 'Read', disabling...
QSocketNotifier: Invalid socket 18 and type 'Read', disabling...
QSocketNotifier: Invalid socket 19 and type 'Exception', disabling...
QSocketNotifier: Invalid socket 20 and type 'Read', disabling...
QSocketNotifier: Invalid socket 25 and type 'Read', disabling...
QSocketNotifier: Invalid socket 14 and type 'Read', disabling...
QSocketNotifier: Invalid socket 16 and type 'Read', disabling...
QSocketNotifier: Invalid socket 15 and type 'Read', disabling...
QSocketNotifier: Invalid socket 8 and type 'Read', disabling...
QSocketNotifier: Invalid socket 9 and type 'Read', disabling...
QSocketNotifier: Invalid socket 10 and type 'Read', disabling...
Comment 4 cwo 2024-07-31 16:33:19 UTC
Thank you for the bug report! This crash is already reported and being tracked, please follow the linked bug report for updates.

*** This bug has been marked as a duplicate of bug 450135 ***