Summary: | KDE connect built from source but binary run from distro packages crashes repeatedly on startup in Device::reloadPlugins() | ||
---|---|---|---|
Product: | [Applications] kdeconnect | Reporter: | Akseli Lahtinen <akselmo> |
Component: | common | Assignee: | Albert Vaca Cintora <albertvaka> |
Status: | CONFIRMED --- | ||
Severity: | crash | CC: | andrew.g.r.holmes, jpetso, nate |
Priority: | NOR | Keywords: | drkonqi, regression |
Version First Reported In: | 24.12.2 | ||
Target Milestone: | --- | ||
Platform: | Compiled Sources | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | ||
Sentry Crash Report: | https://crash-reports.kde.org/organizations/kde/issues/139720/events/00a726507c974ef986ca72a2636b3d46/ |
Description
Akseli Lahtinen
2025-02-27 17:58:23 UTC
Here's another crash. Different plugin, same NetworkPacket destructor. Thread 1 (Thread 0x76470ce3aa00 (LWP 92522)): [KCrash Handler] #5 0x00007647000446bc in std::__atomic_base<int>::fetch_sub (this=0x1b, __i=1, __m=std::memory_order::acq_rel) at /usr/include/c++/14.2.1/bits/atomic_base.h:641 #6 QAtomicOps<int>::deref<int> (_q_value=<error reading variable: Cannot access memory at address 0x1b>) at /usr/include/qt6/QtCore/qatomic_cxx11.h:266 #7 0x00007647000432ec in QBasicAtomicInteger<int>::deref (this=0x1b) at /usr/include/qt6/QtCore/qbasicatomic.h:48 #8 0x00007647000459a2 in QSharedPointer<QIODevice>::deref (dd=0x17) at /usr/include/qt6/QtCore/qsharedpointer_impl.h:475 #9 0x0000764700044b9e in QSharedPointer<QIODevice>::deref (this=0x7ffdbf7582d0) at /usr/include/qt6/QtCore/qsharedpointer_impl.h:471 #10 0x0000764700043b80 in QSharedPointer<QIODevice>::~QSharedPointer (this=0x7ffdbf7582d0, __in_chrg=<optimized out>) at /usr/include/qt6/QtCore/qsharedpointer_impl.h:284 #11 0x0000764700042f98 in NetworkPacket::~NetworkPacket (this=0x7ffdbf7582b0, __in_chrg=<optimized out>) at /home/kpetso/src/kde/network/kdeconnect-kde/core/networkpacket.h:23 #12 0x0000764700040bb8 in SystemvolumePlugin::sendSinkList (this=0x5619b75a3490) at /home/kpetso/src/kde/network/kdeconnect-kde/plugins/systemvolume/systemvolumeplugin-pulse.cpp:105 #13 0x0000764700040d20 in SystemvolumePlugin::connected (this=0x5619b75a3490) at /home/kpetso/src/kde/network/kdeconnect-kde/plugins/systemvolume/systemvolumeplugin-pulse.cpp:118 #14 0x00007647131e9116 in Device::reloadPlugins (this=0x5619b748fe30) at /usr/src/debug/kdeconnect/kdeconnect-kde-24.12.2/core/device.cpp:182 #15 0x00007647131e1d0d in Daemon::onNewDeviceLink (this=0x7ffdbf75a470, link=0x5619b757e8a0) at /usr/src/debug/kdeconnect/kdeconnect-kde-24.12.2/core/daemon.cpp:186 #16 0x00007647115b1a49 in ??? () at /usr/lib/libQt6Core.so.6 #17 0x00007647131c30a2 in LinkProvider::onConnectionReceived (this=<optimized out>, _t1=<optimized out>) at /usr/src/debug/kdeconnect/build/core/kdeconnectcore_autogen/include/moc_linkprovider.cpp:201 #18 0x00007647131ab854 in LanLinkProvider::addLink (this=this@entry=0x5619b718ddc0, socket=socket@entry=0x5619b748ffd0, deviceInfo=...) at /usr/src/debug/kdeconnect/kdeconnect-kde-24.12.2/core/backends/lan/lanlinkprovider.cpp:594 #19 0x00007647131ad152 in LanLinkProvider::encrypted (this=0x5619b718ddc0) at /usr/src/debug/kdeconnect/kdeconnect-kde-24.12.2/core/backends/lan/lanlinkprovider.cpp:398 #20 0x00007647115b1a49 in ??? () at /usr/lib/libQt6Core.so.6 #21 0x000076470008ce60 in QTlsPrivate::TlsCryptographOpenSSL::continueHandshake (this=0x5619b754b3a0) at /usr/src/debug/qt6-base/qtbase/src/plugins/tls/openssl/qtls_openssl.cpp:854 #22 0x000076470008ab33 in QTlsPrivate::TlsCryptographOpenSSL::startHandshake (this=this@entry=0x5619b754b3a0) at /usr/src/debug/qt6-base/qtbase/src/plugins/tls/openssl/qtls_openssl.cpp:740 #23 0x000076470008c700 in QTlsPrivate::TlsCryptographOpenSSL::startHandshake (this=0x5619b754b3a0) at /usr/src/debug/qt6-base/qtbase/src/corelib/tools/qvarlengtharray.h:366 #24 QTlsPrivate::TlsCryptographOpenSSL::transmit (this=0x5619b754b3a0) at /usr/src/debug/qt6-base/qtbase/src/plugins/tls/openssl/qtls_openssl.cpp:994 #25 0x00007647115b1c9a in ??? () at /usr/lib/libQt6Core.so.6 #26 0x00007647108c98b8 in ??? () at /usr/lib/libQt6Network.so.6 #27 0x00007647108d58d2 in ??? () at /usr/lib/libQt6Network.so.6 #28 0x00007647126ff0ca in QApplicationPrivate::notify_helper(QObject*, QEvent*) () at /usr/lib/libQt6Widgets.so.6 #29 0x0000764711555b00 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () at /usr/lib/libQt6Core.so.6 #30 0x00007647117c80f1 in ??? () at /usr/lib/libQt6Core.so.6 #31 0x00007647104a6559 in ??? () at /usr/lib/libglib-2.0.so.0 #32 0x0000764710509257 in ??? () at /usr/lib/libglib-2.0.so.0 #33 0x00007647104a5a55 in g_main_context_iteration () at /usr/lib/libglib-2.0.so.0 #34 0x00007647117c5782 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/libQt6Core.so.6 #35 0x00007647115606a6 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/libQt6Core.so.6 #36 0x00007647115591d6 in QCoreApplication::exec() () at /usr/lib/libQt6Core.so.6 #37 0x00005619b3dbe874 in main (argc=<optimized out>, argv=<optimized out>) at /usr/src/debug/kdeconnect/kdeconnect-kde-24.12.2/daemon/kdeconnectd.cpp:120 Warning: the current language does not match this frame. *** Bug 501012 has been marked as a duplicate of this bug. *** And a third one, the crashing thread originally reported in Bug 501012. As mentioned in that bug report, these kinds of crashes show up frequently for me now when my phone wakes up and presumably sends messages to kdeconnectd on the desktop. They occurred after updating kdeconnect-kde from commit 590aa3884 (Feb 16) to commit d94f1faa9 (Mar 2) and rebuilding together with all the other workspace repositories. Thread 1 (Thread 0x777d01518a00 (LWP 81616)): [KCrash Handler] #5 0x0000777ced6ff01e in std::__atomic_base<int>::fetch_sub (this=0x16, __i=1, __m=std::memory_order::acq_rel) at /usr/include/c++/14.2.1/bits/atomic_base.h:641 #6 QAtomicOps<int>::deref<int> (_q_value=<error reading variable: Cannot access memory at address 0x16>) at /usr/include/qt6/QtCore/qatomic_cxx11.h:266 #7 0x0000777ced6fdf66 in QBasicAtomicInteger<int>::deref (this=0x16) at /usr/include/qt6/QtCore/qbasicatomic.h:48 #8 0x0000777ced6ffda4 in QSharedPointer<QIODevice>::deref (dd=0x12) at /usr/include/qt6/QtCore/qsharedpointer_impl.h:475 #9 0x0000777ced6ff332 in QSharedPointer<QIODevice>::deref (this=0x7ffc566761c0) at /usr/include/qt6/QtCore/qsharedpointer_impl.h:471 #10 0x0000777ced6fe622 in QSharedPointer<QIODevice>::~QSharedPointer (this=0x7ffc566761c0, __in_chrg=<optimized out>) at /usr/include/qt6/QtCore/qsharedpointer_impl.h:284 #11 0x0000777ced6fdbbe in NetworkPacket::~NetworkPacket (this=0x7ffc566761a0, __in_chrg=<optimized out>) at /home/kpetso/src/kde/network/kdeconnect-kde/core/networkpacket.h:23 #12 0x0000777ced6fc280 in BatteryPlugin::slotChargeChanged (this=0x618362d31a80) at /home/kpetso/src/kde/network/kdeconnect-kde/plugins/battery/batteryplugin.cpp:107 #13 0x0000777ced6fbb42 in BatteryPlugin::connected (this=0x618362d31a80) at /home/kpetso/src/kde/network/kdeconnect-kde/plugins/battery/batteryplugin.cpp:58 #14 0x0000777d078c4116 in Device::reloadPlugins (this=0x618362be3670) at /usr/src/debug/kdeconnect/kdeconnect-kde-24.12.2/core/device.cpp:182 #15 0x0000777d078bcd0d in Daemon::onNewDeviceLink (this=0x7ffc56678210, link=0x618362d30330) at /usr/src/debug/kdeconnect/kdeconnect-kde-24.12.2/core/daemon.cpp:186 #16 0x0000777d05db1a49 in ??? () at /usr/lib/libQt6Core.so.6 #17 0x0000777d0789e0a2 in LinkProvider::onConnectionReceived (this=<optimized out>, _t1=<optimized out>) at /usr/src/debug/kdeconnect/build/core/kdeconnectcore_autogen/include/moc_linkprovider.cpp:201 #18 0x0000777d07886854 in LanLinkProvider::addLink (this=this@entry=0x618362950c20, socket=socket@entry=0x618362c6b1b0, deviceInfo=...) at /usr/src/debug/kdeconnect/kdeconnect-kde-24.12.2/core/backends/lan/lanlinkprovider.cpp:594 #19 0x0000777d07888152 in LanLinkProvider::encrypted (this=0x618362950c20) at /usr/src/debug/kdeconnect/kdeconnect-kde-24.12.2/core/backends/lan/lanlinkprovider.cpp:398 #20 0x0000777d05db1a49 in ??? () at /usr/lib/libQt6Core.so.6 #21 0x0000777ced757e60 in QTlsPrivate::TlsCryptographOpenSSL::continueHandshake (this=0x618362900750) at /usr/src/debug/qt6-base/qtbase/src/plugins/tls/openssl/qtls_openssl.cpp:854 #22 0x0000777ced755b33 in QTlsPrivate::TlsCryptographOpenSSL::startHandshake (this=this@entry=0x618362900750) at /usr/src/debug/qt6-base/qtbase/src/plugins/tls/openssl/qtls_openssl.cpp:740 #23 0x0000777ced757700 in QTlsPrivate::TlsCryptographOpenSSL::startHandshake (this=0x618362900750) at /usr/src/debug/qt6-base/qtbase/src/corelib/tools/qvarlengtharray.h:366 #24 QTlsPrivate::TlsCryptographOpenSSL::transmit (this=0x618362900750) at /usr/src/debug/qt6-base/qtbase/src/plugins/tls/openssl/qtls_openssl.cpp:994 #25 0x0000777d05db1c9a in ??? () at /usr/lib/libQt6Core.so.6 #26 0x0000777d04ec98b8 in ??? () at /usr/lib/libQt6Network.so.6 #27 0x0000777d04ed58d2 in ??? () at /usr/lib/libQt6Network.so.6 #28 0x0000777d06eff0ca in QApplicationPrivate::notify_helper(QObject*, QEvent*) () at /usr/lib/libQt6Widgets.so.6 #29 0x0000777d05d55b00 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () at /usr/lib/libQt6Core.so.6 #30 0x0000777d05fc80f1 in ??? () at /usr/lib/libQt6Core.so.6 #31 0x0000777d04b9e559 in ??? () at /usr/lib/libglib-2.0.so.0 #32 0x0000777d04c01257 in ??? () at /usr/lib/libglib-2.0.so.0 #33 0x0000777d04b9da55 in g_main_context_iteration () at /usr/lib/libglib-2.0.so.0 #34 0x0000777d05fc5782 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/libQt6Core.so.6 #35 0x0000777d05d606a6 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/libQt6Core.so.6 #36 0x0000777d05d591d6 in QCoreApplication::exec() () at /usr/lib/libQt6Core.so.6 #37 0x0000618341fd3874 in main (argc=<optimized out>, argv=<optimized out>) at /usr/src/debug/kdeconnect/kdeconnect-kde-24.12.2/daemon/kdeconnectd.cpp:120 Warning: the current language does not match this frame. The common thread among these stack traces is that Device::reloadPlugins() calls plugin->connected(), and it crashes at the end of the function scope, where the scope gets cleaned up. As it so happens, the last thing that each of these functions do is to call sendPacket(NetworkPacket &). My Android version of KDE Connect is 1.33.0 by the way. I had a look at some of the commits to track down the cause. It looks like commit d04a3336bc2855880ac9a9591f3ec907c6f8dc36 in kdeconnect-kde is the culprit. By reverting to the commit immediately before and restarting kdeconnectd, the problem stops happening. Let's link to the commit in Invent: https://invent.kde.org/network/kdeconnect-kde/-/commit/d04a3336bc2855880ac9a9591f3ec907c6f8dc36 There is a straightforward bug in this commit, in this change: > - obj.insert(QLatin1String("id"), m_id); > + obj.insert(QLatin1String("id"), QDateTime::currentMSecsSinceEpoch()); m_id was a QString though, so this line should likely adopt the QString::number() conversion that the m_id initializer was using before: > obj.insert(QLatin1String("id"), QString::number(QDateTime::currentMSecsSinceEpoch())); However, fixing the type for the "id" property does not seem to make it work. Still crashing. I'm not sure what else is going wrong here. Ah, I see what's going on. The (updated, binary-incompatible) NetworkProvider destructor is executed for code in our build directories, e.g.: > #12 NetworkPacket::~NetworkPacket (this=0x7ffd3362d940, __in_chrg=<optimized out>) at /home/akseli/Repositories/kde/src/kdeconnect-kde/core/networkpacket.h:23 #13 ClipboardPlugin::sendConnectPacket (this=0x56438c436310) at /home/akseli/Repositories/kde/src/kdeconnect-kde/plugins/clipboard/clipboardplugin.cpp:85 However, the code further up the stack comes from Arch packages, as can be induced from the /usr/src/ build directory: #14 0x00007f016c8d9039 in Device::reloadPlugins (this=0x56438cbe3e30) at /usr/src/debug/kde-connect-24.12.2-1.fc41.x86_64/core/device.cpp:182 #15 0x00007f016c8d1e5b in Daemon::onNewDeviceLink (this=0x7ffd3362f990, link=0x56438ccc6af0) at /usr/src/debug/kde-connect-24.12.2-1.fc41.x86_64/core/daemon.cpp:186 Because m_id got removed from NetworkPacket and is used from a bunch of places, it's likely that there is a mismatch between constructor and destructor depending on which code exactly is creating or destroying the NetworkPacket at hand. Running kdeconnectd manually from my build directory (/home/kpetso/build/prefix/bin/kdeconnectd) as opposed to the binary from the Arch package (/usr/bin/kdeconnectd) makes it not crash anymore. Although there are still lots of warnings in the debug output like > kdeconnect.core: missing property 0x555555aa8fc0 "id" from qjsonobject2qobject() at networkpacket.cpp:71. Starting today, I'm experiencing this non-stop, and similarly can make it stop by manually running my built-from-source binary: killall -9 kdeconnectd kstart -- ~/kde/usr/bin/kdeconnectd & That makes this pretty much a dev setup issue, right? |