Bug 246638

Summary: kded crashes in latest trunk
Product: [Unmaintained] solid Reporter: Robert Marmorstein <robert>
Component: bluetooth-daemonAssignee: Rafael Fernández López <ereslibre>
Status: RESOLVED FIXED    
Severity: crash CC: afiestas, alexanders83, lamarque, mail
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: Fix crash when no bluetooth adapter is activated.

Description Robert Marmorstein 2010-08-03 21:40:51 UTC
Application: kded4 ($Id: kded.cpp 1151015 2010-07-17 13:50:01Z pokrzywka $)
KDE Platform Version: 4.5.62 (KDE 4.5.62 (KDE 4.6 >= 20100729)) (Compiled from sources)
Qt Version: 4.7.0
Operating System: Linux 2.6.34-ARCH x86_64
Distribution (Platform): Archlinux Packages

-- Information about the crash:
Upon KDE login, kded crashes immediately.  This happened only after I updated trunk this morning.  I have not yet tried moving all my old dotfiles out of the way.

The crash can be reproduced every time.

-- Backtrace:
Application: KDE Daemon (kdeinit4), signal: Aborted
[KCrash Handler]
#6  0x00007fb57a460565 in raise () from /lib/libc.so.6
#7  0x00007fb57a4619e6 in abort () from /lib/libc.so.6
#8  0x00007fb57bf4dc6e in qt_message_output (msgType=<value optimized out>, buf=<value optimized out>) at global/qglobal.cpp:2259
#9  0x00007fb57bf4dd4e in qt_message (msgType=QtFatalMsg, msg=0x7fb57c36749a "QDBusArgument: read from a write-only object", ap=0x7fff5d92e0c0) at global/qglobal.cpp:2305
#10 0x00007fb57bf4de6d in qFatal (msg=<value optimized out>) at global/qglobal.cpp:2488
#11 0x00007fb57c358455 in QDBusArgumentPrivate::checkRead (d=<value optimized out>) at qdbusargument.cpp:144
#12 0x00007fb57c35846b in QDBusArgumentPrivate::checkReadAndDetach (d=@0x7fff5d92e3f0) at qdbusargument.cpp:154
#13 0x00007fb57c3595e5 in QDBusArgument::beginArray (this=0x7fff5d92e3f0) at qdbusargument.cpp:965
#14 0x00007fb5679eeab8 in BlueDevil::Manager::Manager(QObject*) () from /usr/lib/libbluedevil.so.1
#15 0x00007fb5679f014a in BlueDevil::Manager::self() () from /usr/lib/libbluedevil.so.1
#16 0x00007fb567ececd8 in BlueDevilDaemon::BlueDevilDaemon(QObject*, QList<QVariant> const&) () from /usr/lib/kde4/kded_bluedevil.so
#17 0x00007fb567ecf097 in QObject* KPluginFactory::createInstance<BlueDevilDaemon, QObject>(QWidget*, QObject*, QList<QVariant> const&) () from /usr/lib/kde4/kded_bluedevil.so
#18 0x00007fb57c72727a in KPluginFactory::create (this=0x1a051c0, iface=0x7fb57c7696e0 "KDEDModule", parentWidget=0x0, parent=0x18310c0, args=..., keyword=...)
    at /var/abs/local/eth-os/sources/KDE/kdelibs/kdecore/util/kpluginfactory.cpp:191
#19 0x00007fb56fc02348 in KPluginFactory::create<KDEDModule> (this=0x1a051c0, parent=0x18310c0, args=...) at /var/abs/local/eth-os/sources/KDE/kdelibs/kdecore/util/kpluginfactory.h:491
#20 0x00007fb56fc00449 in Kded::loadModule (this=0x18310c0, s=<value optimized out>, onDemand=<value optimized out>) at /var/abs/local/eth-os/sources/KDE/kdelibs/kded/kded.cpp:385
#21 0x00007fb56fc00da6 in Kded::initModules (this=0x18310c0) at /var/abs/local/eth-os/sources/KDE/kdelibs/kded/kded.cpp:243
#22 0x00007fb56fc03d9e in KDEDApplication::newInstance (this=<value optimized out>) at /var/abs/local/eth-os/sources/KDE/kdelibs/kded/kded.cpp:822
#23 0x00007fb57cf44f2f in KUniqueApplicationAdaptor::newInstance (this=0x1975b40, asn_id=<value optimized out>, args=...)
    at /var/abs/local/eth-os/sources/KDE/kdelibs/kdeui/kernel/kuniqueapplication.cpp:436
#24 0x00007fb57cf44fa4 in KUniqueApplicationAdaptor::qt_metacall (this=0x1975b40, _c=QMetaObject::InvokeMetaMethod, _id=0, _a=0x7fff5d92ef10)
    at /var/abs/local/eth-os/sources/KDE/kdelibs/build/kdeui/kuniqueapplication_p.moc:81
#25 0x00007fb57c33ab42 in QDBusConnectionPrivate::deliverCall (this=0x1819550, object=0x1975b40, msg=..., metaTypes=<value optimized out>, slotIdx=4) at qdbusintegrator.cpp:916
#26 0x00007fb57c33c3df in QDBusConnectionPrivate::activateCall (this=0x1819550, object=0x1975b40, flags=337, msg=...) at qdbusintegrator.cpp:819
#27 0x00007fb57c33c94d in QDBusConnectionPrivate::activateObject (this=0x1819550, node=..., msg=..., pathStartPos=<value optimized out>) at qdbusintegrator.cpp:1396
#28 0x00007fb57c33c9e8 in QDBusActivateObjectEvent::placeMetaCall (this=0x196f880) at qdbusintegrator.cpp:1490
#29 0x00007fb57c000210 in QObject::event (this=0x7fff5d92fe50, e=<value optimized out>) at kernel/qobject.cpp:1211
#30 0x00007fb57b3373a9 in QApplication::event (this=0x7fff5d92fe50, e=0x196f880) at kernel/qapplication.cpp:2442
#31 0x00007fb57b335546 in QApplicationPrivate::notify_helper (this=0x1832370, receiver=0x7fff5d92fe50, e=0x196f880) at kernel/qapplication.cpp:4392
#32 0x00007fb57b33c393 in QApplication::notify (this=<value optimized out>, receiver=0x7fff5d92fe50, e=0x196f880) at kernel/qapplication.cpp:4357
#33 0x00007fb57cf405dc in KApplication::notify (this=0x7fff5d92fe50, receiver=0x7fff5d92fe50, event=0x196f880) at /var/abs/local/eth-os/sources/KDE/kdelibs/kdeui/kernel/kapplication.cpp:284
#34 0x00007fb57bff08ba in QCoreApplication::notifyInternal (this=0x7fff5d92fe50, receiver=0x7fff5d92fe50, event=<value optimized out>) at kernel/qcoreapplication.cpp:732
#35 0x00007fb57bff2cef in QCoreApplicationPrivate::sendPostedEvents (receiver=0x0, event_type=0, data=0x1784c00) at kernel/qcoreapplication.cpp:1373
#36 0x00007fb57c01014c in postEventSourceDispatch (s=0x1835eb0) at kernel/qeventdispatcher_glib.cpp:277
#37 0x00007fb577128b33 in g_main_context_dispatch () from /usr/lib/libglib-2.0.so.0
#38 0x00007fb577129310 in g_main_context_iterate () from /usr/lib/libglib-2.0.so.0
#39 0x00007fb5771295ad in g_main_context_iteration () from /usr/lib/libglib-2.0.so.0
#40 0x00007fb57c0104c8 in QEventDispatcherGlib::processEvents (this=0x1786ef0, flags=<value optimized out>) at kernel/qeventdispatcher_glib.cpp:415
#41 0x00007fb57b3b3f24 in QGuiEventDispatcherGlib::processEvents (this=<value optimized out>, flags=<value optimized out>) at kernel/qguieventdispatcher_glib.cpp:204
#42 0x00007fb57bfef8a3 in QEventLoop::processEvents (this=<value optimized out>, flags=...) at kernel/qeventloop.cpp:149
#43 0x00007fb57bfefa80 in QEventLoop::exec (this=0x7fff5d92fdb0, flags=...) at kernel/qeventloop.cpp:201
#44 0x00007fb57bff2f6e in QCoreApplication::exec () at kernel/qcoreapplication.cpp:1009
#45 0x00007fb56fbffd5b in kdemain (argc=1, argv=0x17fd8d0) at /var/abs/local/eth-os/sources/KDE/kdelibs/kded/kded.cpp:900
#46 0x0000000000407333 in launch (argc=1, _name=0x40a518 "kded4", args=<value optimized out>, cwd=0x0, envc=0, envs=<value optimized out>, reset_env=false, tty=0x0, avoid_loops=false, 
    startup_id_str=0x409bc5 "0") at /var/abs/local/eth-os/sources/KDE/kdelibs/kinit/kinit.cpp:727
#47 0x00000000004085f1 in main (argc=4, argv=<value optimized out>, envp=0x7fff5d9306c0) at /var/abs/local/eth-os/sources/KDE/kdelibs/kinit/kinit.cpp:1841

Reported using DrKonqi
Comment 1 Alexander Stein 2010-08-04 22:00:39 UTC
I also get a similar crash from bluedevil when I installed it just during that session (no kded using bluedevil):
Application: Bluetooth (bluedevil-monolithic), signal: Aborted
Traceback (most recent call last):
  File "/usr/share/gdb/auto-load/usr/lib64/libgobject-2.0.so.0.2200.5-gdb.py", line 9, in <module>
    from gobject import register
  File "/usr/share/glib-2.0/gdb/gobject.py", line 3, in <module>
    import gdb.backtrace
ImportError: No module named backtrace
[KCrash Handler]
#5  0x00007f0a661ef1b5 in raise () from /lib/libc.so.6
#6  0x00007f0a661f05e0 in abort () from /lib/libc.so.6
#7  0x00007f0a675f8b64 in qt_message_output(QtMsgType, char const*) () from /usr/lib64/qt4/libQtCore.so.4
#8  0x00007f0a675f8cfe in qt_message(QtMsgType, char const*, __va_list_tag*) () from /usr/lib64/qt4/libQtCore.so.4
#9  0x00007f0a675f8eb5 in qFatal(char const*, ...) () from /usr/lib64/qt4/libQtCore.so.4
#10 0x00007f0a67a7d764 in QDBusArgumentPrivate::checkRead(QDBusArgumentPrivate*) () from /usr/lib64/qt4/libQtDBus.so.4
#11 0x00007f0a67a7dc8f in QDBusArgumentPrivate::checkReadAndDetach(QDBusArgumentPrivate*&) () from /usr/lib64/qt4/libQtDBus.so.4
#12 0x00007f0a67a7ddc9 in QDBusArgument::beginArray() const () from /usr/lib64/qt4/libQtDBus.so.4
#13 0x00007f0a68147ac0 in BlueDevil::Manager::Manager(QObject*) () from /usr/lib64/libbluedevil.so.1
#14 0x00007f0a6814847a in BlueDevil::Manager::self() () from /usr/lib64/libbluedevil.so.1
#15 0x0000000000407319 in Monolithic::generateDeviceEntries() ()
#16 0x0000000000408b43 in Monolithic::onlineMode() ()
#17 0x0000000000408d22 in Monolithic::Monolithic(QObject*) ()
#18 0x0000000000404ed0 in main ()

I observed this is caused by the fact, there is no org.bluez entry in dbus. This is caused by having no bluetooth adapter attached.
Once I attach it (USB device), I get a org.bluez entry in dbus and I can start bluedevil.
The same can be adopted to kded. no adapter attached -> crash. adapter attached -> kded starts without problems
Comment 2 Lamarque V. Souza 2010-08-30 05:41:12 UTC
Bluedevil crashes kded4 at login here if my bluetooth controller is switched off.
Comment 3 Lamarque V. Souza 2010-08-31 02:13:43 UTC
Created attachment 51130 [details]
Fix crash when no bluetooth adapter is activated.

This patch fix the crash. I think bluetooth authors must change their code to not rely on DBus calls. The reply is not always a valid reference and there are other places in (lib)bluedevil code where you use the reference without checking if it is valid.
Comment 4 Alex Fiestas 2010-09-05 22:56:55 UTC
*** Bug 247845 has been marked as a duplicate of this bug. ***
Comment 5 Alex Fiestas 2010-09-05 22:57:55 UTC
(In reply to comment #3)
> Created an attachment (id=51130) [details]
> Fix crash when no bluetooth adapter is activated.
> 
> This patch fix the crash. I think bluetooth authors must change their code to
> not rely on DBus calls. The reply is not always a valid reference and there are
> other places in (lib)bluedevil code where you use the reference without
> checking if it is valid.
Ereslibre will take a look at the patch ASAP, thank  you!
Comment 6 Alex Fiestas 2010-09-06 16:14:59 UTC
Hi, the Lamarque patch has been applied, should I close the bug?

Thanks!
Comment 7 Alex Fiestas 2010-09-12 23:26:32 UTC
Hi there

Can anybody test this bug using libbluedevil 1.8? this should be fixed thanks to Lamarque patch.

Thanks!
Comment 8 Alex Fiestas 2010-10-03 16:13:13 UTC
Start to move bluedevil bugs into solid product as Albert and Kevin tell me.
Comment 9 Alex Fiestas 2010-10-11 21:53:05 UTC
This bug seems to be fixed thanks to lamarque patch, so I'm going to close it.

If you can reproduce it, feel free to re-open it.