Bug 339707

Summary: Apps using KStatusNotifierItem crash when plasmashell is quit
Product: [Frameworks and Libraries] frameworks-knotifications Reporter: Eike Hein <hein>
Component: generalAssignee: Martin Klapetek <mklapetek>
Status: RESOLVED FIXED    
Severity: crash CC: bhush94, hrvoje.senjan, kde, kdelibs-bugs, mail, simonandric5
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Eike Hein 2014-10-05 15:36:50 UTC
I'm getting identical backtraces from KMix, Konversation, etc.:

Application: KMix (kmix), signal: Segmentation fault
Using host libthread_db library "/lib64/libthread_db.so.1".
[Current thread is 1 (Thread 0x7fc0340b5800 (LWP 2243))]

Thread 2 (Thread 0x7fc02b0d3700 (LWP 2244)):
#0  0x00007fc03ff0a1dd in poll () from /lib64/libc.so.6
#1  0x00007fc03d863142 in _xcb_conn_wait () from /lib64/libxcb.so.1
#2  0x00007fc03d864ccf in xcb_wait_for_event () from /lib64/libxcb.so.1
#3  0x00007fc02da6dbd7 in QXcbEventReader::run (this=0x8eab60) at qxcbconnection.cpp:1089
#4  0x00007fc04152d885 in QThreadPrivate::start (arg=0x8eab60) at thread/qthread_unix.cpp:337
#5  0x00007fc03dfff52a in start_thread () from /lib64/libpthread.so.0
#6  0x00007fc03ff1577d in clone () from /lib64/libc.so.6

Thread 1 (Thread 0x7fc0340b5800 (LWP 2243)):
[KCrash Handler]
#6  0x00007fc04178b266 in QObject::thread (this=0xd33220) at kernel/qobject.cpp:1412
#7  0x00007fc04178a13a in QObject::QObject (this=0xdd1220, parent=0xd33220) at kernel/qobject.cpp:808
#8  0x00007fc03eb0bc6c in DBusMenuExporter::DBusMenuExporter (this=0xdd1220, objectPath=..., menu=0xd33220, _connection=...) at /home/sho/devel/src/libdbusmenu-qt/src/dbusmenuexporter.cpp:331
#9  0x00007fc045f4cd08 in KDBusMenuExporter::KDBusMenuExporter (this=0xdd1220, dbusObjectPath=..., menu=0xd33220, dbusConnection=...) at /home/sho/devel/src/frameworks/knotifications/src/kstatusnotifieritem.cpp:59
#10 0x00007fc045f484fd in KStatusNotifierItem::setContextMenu (this=0xcb5c10, menu=0xd33220) at /home/sho/devel/src/frameworks/knotifications/src/kstatusnotifieritem.cpp:423
#11 0x00007fc02a4ae41c in KDEPlatformSystemTrayIcon::updateMenu (this=0xd012f0, menu=0xa97810) at /home/sho/devel/src/frameworks/frameworkintegration/src/platformtheme/kdeplatformsystemtrayicon.cpp:296
#12 0x00007fc042699d6c in QSystemTrayIconPrivate::updateMenu_sys_qpa (this=0xd05c70) at util/qsystemtrayicon.cpp:712
#13 0x00007fc0426bacde in QSystemTrayIconPrivate::updateMenu_sys (this=0xd05c70) at util/qsystemtrayicon_x11.cpp:305
#14 0x00007fc042697c89 in QSystemTrayIcon::setContextMenu (this=0xc84f30, menu=0xb89900) at util/qsystemtrayicon.cpp:166
#15 0x00007fc045f4842d in KStatusNotifierItem::setContextMenu (this=0xb84490, menu=0xb89900) at /home/sho/devel/src/frameworks/knotifications/src/kstatusnotifieritem.cpp:411
#16 0x00007fc045f4a5b1 in KStatusNotifierItemPrivate::setLegacySystemTrayEnabled (this=0xb84710, enabled=true) at /home/sho/devel/src/frameworks/knotifications/src/kstatusnotifieritem.cpp:843
#17 0x00007fc045f4a27a in KStatusNotifierItemPrivate::setLegacyMode (this=0xb84710, legacy=true) at /home/sho/devel/src/frameworks/knotifications/src/kstatusnotifieritem.cpp:788
#18 0x00007fc045f4a237 in KStatusNotifierItemPrivate::checkForRegisteredHosts (this=0xb84710) at /home/sho/devel/src/frameworks/knotifications/src/kstatusnotifieritem.cpp:781
#19 0x00007fc045f4b33f in KStatusNotifierItem::qt_static_metacall (_o=0xb84490, _c=QMetaObject::InvokeMetaMethod, _id=6, _a=0x7fff3abf8b80) at /home/sho/devel/build/frameworks/knotifications/src/moc_kstatusnotifieritem.cpp:184
#20 0x00007fc0417918df in QMetaObject::activate (sender=0xb90330, signalOffset=3, local_signal_index=1, argv=0x0) at kernel/qobject.cpp:3716
#21 0x00007fc0417910f0 in QMetaObject::activate (sender=0xb90330, m=0x7fc046182fa0 <OrgKdeStatusNotifierWatcherInterface::staticMetaObject>, local_signal_index=1, argv=0x0) at kernel/qobject.cpp:3582
#22 0x00007fc045f64067 in OrgKdeStatusNotifierWatcherInterface::StatusNotifierHostUnregistered (this=0xb90330) at /home/sho/devel/build/frameworks/knotifications/src/statusnotifierwatcher_interface.moc:222
#23 0x00007fc045f63c0b in OrgKdeStatusNotifierWatcherInterface::qt_static_metacall (_o=0xb90330, _c=QMetaObject::InvokeMetaMethod, _id=1, _a=0x7fff3abf8d50) at /home/sho/devel/build/frameworks/knotifications/src/statusnotifierwatcher_interface.moc:108
#24 0x00007fc045f63ee3 in OrgKdeStatusNotifierWatcherInterface::qt_metacall (this=0xb90330, _c=QMetaObject::InvokeMetaMethod, _id=1, _a=0x7fff3abf8d50) at /home/sho/devel/build/frameworks/knotifications/src/statusnotifierwatcher_interface.moc:173
#25 0x00007fc0479359bf in QDBusConnectionPrivate::deliverCall (this=0x8cf020, object=0xb90330, msg=..., metaTypes=..., slotIdx=7) at qdbusintegrator.cpp:990
#26 0x00007fc0479401cd in QDBusCallDeliveryEvent::placeMetaCall (this=0xd05570, object=0xb90330) at qdbusintegrator_p.h:95
#27 0x00007fc04178aea4 in QObject::event (this=0xb90330, e=0xd05570) at kernel/qobject.cpp:1245
#28 0x00007fc042276ff0 in QApplicationPrivate::notify_helper (this=0x8df360, receiver=0xb90330, e=0xd05570) at kernel/qapplication.cpp:3722
#29 0x00007fc042274760 in QApplication::notify (this=0x8ce680, receiver=0xb90330, e=0xd05570) at kernel/qapplication.cpp:3164
#30 0x00007fc04174e47e in QCoreApplication::notifyInternal (this=0x8ce680, receiver=0xb90330, event=0xd05570) at kernel/qcoreapplication.cpp:932
#31 0x00007fc0417520df in QCoreApplication::sendEvent (receiver=0xb90330, event=0xd05570) at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:228
#32 0x00007fc04174f7b7 in QCoreApplicationPrivate::sendPostedEvents (receiver=0x0, event_type=0, data=0x8c4d00) at kernel/qcoreapplication.cpp:1536
#33 0x00007fc04174f166 in QCoreApplication::sendPostedEvents (receiver=0x0, event_type=0) at kernel/qcoreapplication.cpp:1394
#34 0x00007fc0417c6fd0 in postEventSourceDispatch (s=0x92e790) at kernel/qeventdispatcher_glib.cpp:271
#35 0x00007fc040a49afb in g_main_context_dispatch () from /lib64/libglib-2.0.so.0
#36 0x00007fc040a49e98 in g_main_context_iterate.isra () from /lib64/libglib-2.0.so.0
#37 0x00007fc040a49f4c in g_main_context_iteration () from /lib64/libglib-2.0.so.0
#38 0x00007fc0417c778b in QEventDispatcherGlib::processEvents (this=0x921a50, flags=...) at kernel/qeventdispatcher_glib.cpp:418
#39 0x00007fc02daae644 in QPAEventDispatcherGlib::processEvents (this=0x921a50, flags=...) at eventdispatchers/qeventdispatcher_glib.cpp:115
#40 0x00007fc04174b122 in QEventLoop::processEvents (this=0x7fff3abf9c80, flags=...) at kernel/qeventloop.cpp:128
#41 0x00007fc04174b3fb in QEventLoop::exec (this=0x7fff3abf9c80, flags=...) at kernel/qeventloop.cpp:204
#42 0x00007fc04174eb58 in QCoreApplication::exec () at kernel/qcoreapplication.cpp:1185
#43 0x00007fc041b36d24 in QGuiApplication::exec () at kernel/qguiapplication.cpp:1532
#44 0x00007fc042273f8d in QApplication::exec () at kernel/qapplication.cpp:2956
#45 0x00007fc0475b06e8 in kdemain (argc=5, argv=0x7fff3abfa288) at /home/sho/devel/src/kde/kdemultimedia/kmix/apps/main.cpp:91
#46 0x0000000000400be8 in main (argc=5, argv=0x7fff3abfa288) at /home/sho/devel/build/kde/kdemultimedia/kmix/kmix_dummy.cpp:3


Reproducible: Always
Comment 1 Eike Hein 2014-10-05 15:37:16 UTC
Version info: Qt 5.4 branch tip, KF5 master branch tip.

Possibly related to bug 335284.
Comment 2 Martin Klapetek 2014-10-05 17:46:02 UTC
Possibly related to the recent changes of KSNI :S
Comment 3 Martin Klapetek 2014-10-06 08:25:13 UTC
When is it crashing? Or how to reproduce this crash?
Comment 4 Eike Hein 2014-10-06 10:32:04 UTC
Just kquitapp5 is enough for me. But I just realized that I use wmsystray for ibus, so KSNI probably spins down to x11embed then.
Comment 5 Martin Klapetek 2014-10-06 11:29:01 UTC
I cannot reproduce at all even with wmsystemtray running (with dropbox icon). 

I'll wait if more reports will come in
Comment 6 Martin Klapetek 2014-10-13 20:03:22 UTC
*** Bug 339941 has been marked as a duplicate of this bug. ***
Comment 7 Eike Hein 2014-12-15 19:36:00 UTC
This keeps happening here - and I don't use wmsystemtray anymore, btw.
Comment 8 Martin Klapetek 2014-12-15 22:07:53 UTC
Unfortunately you are still the only one with this issue (reported, anyway) and I honestly have no clue what's going south.

Maybe it's libdbusmenu-qt? I believe this is stupid question but is it "recent enough"?
Comment 9 Hrvoje Senjan 2014-12-15 22:24:00 UTC
i also still have the issue on regular basis (the dup 339941)
(regular means, at least on 70% after quitting plasmashell)

libdbusmenu-qt(5) is at 0.9.3+14.10.20140619

this iirc only started to happen after David's 'Qt 5.4 fix'
Comment 10 Martin Klapetek 2014-12-15 22:27:45 UTC
Can you guys try to revert that commit and see if it really is that one?

Actually there are two:

b0e56119ab78e839fdaa7bf47370510dd0f3c8b1
fdc1ee538d249845061105412f28017ac77f618d

Try just one first and see if it fixes it.
Comment 11 Eike Hein 2014-12-16 18:47:49 UTC
No luck, with either one or both reverted I still see KMix crash or quit when restarting plasmashell.
Comment 12 Elias Probst 2014-12-30 21:33:08 UTC
*** Bug 339307 has been marked as a duplicate of this bug. ***
Comment 13 Martin Klapetek 2015-01-05 10:56:58 UTC
Alright, this seems related to Qt5.4. Now I can reproduce too, so investigating.
Comment 14 Martin Klapetek 2015-01-14 15:13:27 UTC
Git commit 072679bd7044021b08a3ef04909719b5b3479f58 by Martin Klapetek.
Committed on 14/01/2015 at 15:13.
Pushed by mklapetek into branch 'master'.

Properly check for systray being available

The "org.kde.StatusNotifierWatcher" is just a watcher/helper, not the
actual systray object, that's "org.kde.StatusNotifierHost-$PID". Because
Plasma appends the PID (as per the specification), we cannot check
directly for it being present on the bus, so we check the
org.kde.StatusNotifierWatcher.IsStatusNotifierHostRegistered property
that's meant to be used for this.

Plus QSystemTrayIcon::isSystemTrayAvailable() is actually returning
always true, because the Watcher is in kded and is /always/ present.

This also fixes many apps with KSNI crashing on plasma exit, bug 339707
(though I believe this is not the direct cause for that bug)

REVIEW: 121885
CHANGELOG

M  +7    -5    src/platformtheme/kdeplatformsystemtrayicon.cpp

http://commits.kde.org/frameworkintegration/072679bd7044021b08a3ef04909719b5b3479f58