Bug 335284

Summary: Klipper crashes when restarting plasmashell
Product: [Frameworks and Libraries] frameworks-knotifications Reporter: Elias Probst <mail>
Component: generalAssignee: Martin Klapetek <mklapetek>
Status: RESOLVED WORKSFORME    
Severity: crash CC: kdelibs-bugs, mgraesslin
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: unspecified   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Elias Probst 2014-05-24 15:10:25 UTC
When restarting plasmashell (systemctl --user restart plasmashell), Klipper crashes with the backtrace below.
Running all KF5/Plasma components fresh from git, Qt 5.3.0.

Application: Klipper (klipper), signal: Segmentation fault
Using host libthread_db library "/lib64/libthread_db.so.1".
[Current thread is 1 (Thread 0x7fb1d5709800 (LWP 19107))]

Thread 2 (Thread 0x7fb1c1ac6700 (LWP 19108)):
#0  0x00007fb1d5088f0d in poll () at ../sysdeps/unix/syscall-template.S:81
#1  0x00007fb1d02ec1f2 in poll (__timeout=-1, __nfds=1, __fds=0x7fb1c1ac5cd0) at /usr/include/bits/poll2.h:46
#2  _xcb_conn_wait (c=c@entry=0xbee320, cond=cond@entry=0xbee360, vector=vector@entry=0x0, count=count@entry=0x0) at /var/tmp/portage/x11-libs/libxcb-1.10/work/libxcb-1.10/src/xcb_conn.c:447
#3  0x00007fb1d02eddf7 in xcb_wait_for_event (c=0xbee320) at /var/tmp/portage/x11-libs/libxcb-1.10/work/libxcb-1.10/src/xcb_in.c:622
#4  0x00007fb1c42cded9 in QXcbEventReader::run (this=0xbf8390) at qxcbconnection.cpp:1034
#5  0x00007fb1d0ab1e8f in QThreadPrivate::start (arg=0xbf8390) at thread/qthread_unix.cpp:345
#6  0x00007fb1cc336f3a in start_thread (arg=0x7fb1c1ac6700) at pthread_create.c:308
#7  0x00007fb1d5092c3d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:113

Thread 1 (Thread 0x7fb1d5709800 (LWP 19107)):
[KCrash Handler]
#6  0x00007fb1d0cc4592 in QObject::installEventFilter (this=this@entry=0xf66600, obj=obj@entry=0xe42650) at kernel/qobject.cpp:2033
#7  0x00007fb1d3b09027 in KStatusNotifierItem::setContextMenu (this=0xe42650, menu=0xf66600) at /var/tmp/portage/kde-frameworks/knotifications-9999/work/knotifications-9999/src/kstatusnotifieritem.cpp:419
#8  0x00007fb1d3b08f94 in KStatusNotifierItem::setContextMenu (this=0x7fffd26bc5c0, menu=0xc82ac0) at /var/tmp/portage/kde-frameworks/knotifications-9999/work/knotifications-9999/src/kstatusnotifieritem.cpp:411
#9  0x00007fb1d3b0985a in KStatusNotifierItemPrivate::setLegacySystemTrayEnabled (this=0xcb9940, enabled=enabled@entry=true) at /var/tmp/portage/kde-frameworks/knotifications-9999/work/knotifications-9999/src/kstatusnotifieritem.cpp:843
#10 0x00007fb1d3b0c3da in KStatusNotifierItemPrivate::setLegacyMode (this=this@entry=0xcb9940, legacy=<optimized out>) at /var/tmp/portage/kde-frameworks/knotifications-9999/work/knotifications-9999/src/kstatusnotifieritem.cpp:792
#11 0x00007fb1d3b0c42a in KStatusNotifierItemPrivate::checkForRegisteredHosts (this=0xcb9940) at /var/tmp/portage/kde-frameworks/knotifications-9999/work/knotifications-9999/src/kstatusnotifieritem.cpp:781
#12 0x00007fb1d3b0c781 in KStatusNotifierItem::qt_static_metacall (_o=<optimized out>, _c=<optimized out>, _id=<optimized out>, _a=<optimized out>) at /var/tmp/portage/kde-frameworks/knotifications-9999/work/knotifications-9999_build/src/moc_kstatusnotifieritem.cpp:183
#13 0x00007fb1d0cbddd6 in QMetaObject::activate (sender=sender@entry=0xcbedc0, signalOffset=<optimized out>, local_signal_index=local_signal_index@entry=1, argv=argv@entry=0x0) at kernel/qobject.cpp:3680
#14 0x00007fb1d0cbe297 in QMetaObject::activate (sender=sender@entry=0xcbedc0, m=m@entry=0x7fb1d3d34180 <OrgKdeStatusNotifierWatcherInterface::staticMetaObject>, local_signal_index=local_signal_index@entry=1, argv=argv@entry=0x0) at kernel/qobject.cpp:3546
#15 0x00007fb1d3b226b3 in StatusNotifierHostUnregistered (this=0xcbedc0) at /var/tmp/portage/kde-frameworks/knotifications-9999/work/knotifications-9999_build/src/statusnotifierwatcher_interface.moc:220
#16 OrgKdeStatusNotifierWatcherInterface::qt_static_metacall (_o=_o@entry=0xcbedc0, _c=_c@entry=QMetaObject::InvokeMetaMethod, _id=_id@entry=1, _a=_a@entry=0x7fffd26bbf10) at /var/tmp/portage/kde-frameworks/knotifications-9999/work/knotifications-9999_build/src/statusnotifierwatcher_interface.moc:107
#17 0x00007fb1d3b228bf in OrgKdeStatusNotifierWatcherInterface::qt_metacall (this=0xcbedc0, _c=QMetaObject::InvokeMetaMethod, _id=1, _a=0x7fffd26bbf10) at /var/tmp/portage/kde-frameworks/knotifications-9999/work/knotifications-9999_build/src/statusnotifierwatcher_interface.moc:172
#18 0x00007fb1d20134bf in QDBusConnectionPrivate::deliverCall (this=0xbcc9d0, object=0xcbedc0, msg=..., metaTypes=..., slotIdx=7) at qdbusintegrator.cpp:991
#19 0x00007fb1d0cbea76 in QObject::event (this=0xcbedc0, e=<optimized out>) at kernel/qobject.cpp:1241
#20 0x00007fb1d19297ac in QApplicationPrivate::notify_helper (this=this@entry=0xbdc890, receiver=receiver@entry=0xcbedc0, e=e@entry=0x1022230) at kernel/qapplication.cpp:3500
#21 0x00007fb1d192e526 in QApplication::notify (this=0x7fffd26bc5a0, receiver=0xcbedc0, e=0x1022230) at kernel/qapplication.cpp:3283
#22 0x00007fb1d0c8efe5 in QCoreApplication::notifyInternal (this=0x7fffd26bc5a0, receiver=0xcbedc0, event=event@entry=0x1022230) at kernel/qcoreapplication.cpp:935
#23 0x00007fb1d0c90e37 in sendEvent (event=0x1022230, receiver=<optimized out>) at kernel/qcoreapplication.h:237
#24 QCoreApplicationPrivate::sendPostedEvents (receiver=receiver@entry=0x0, event_type=event_type@entry=0, data=0xbc51a0) at kernel/qcoreapplication.cpp:1539
#25 0x00007fb1d0c91468 in QCoreApplication::sendPostedEvents (receiver=receiver@entry=0x0, event_type=event_type@entry=0) at kernel/qcoreapplication.cpp:1397
#26 0x00007fb1d0ce6633 in postEventSourceDispatch (s=s@entry=0xc178f0) at kernel/qeventdispatcher_glib.cpp:279
#27 0x00007fb1cad74b75 in g_main_dispatch (context=0x7fb1bc002e00) at /var/tmp/portage/dev-libs/glib-2.38.2-r1/work/glib-2.38.2/glib/gmain.c:3066
#28 g_main_context_dispatch (context=context@entry=0x7fb1bc002e00) at /var/tmp/portage/dev-libs/glib-2.38.2-r1/work/glib-2.38.2/glib/gmain.c:3642
#29 0x00007fb1cad74eb8 in g_main_context_iterate (context=context@entry=0x7fb1bc002e00, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at /var/tmp/portage/dev-libs/glib-2.38.2-r1/work/glib-2.38.2/glib/gmain.c:3713
#30 0x00007fb1cad74f74 in g_main_context_iteration (context=0x7fb1bc002e00, may_block=1) at /var/tmp/portage/dev-libs/glib-2.38.2-r1/work/glib-2.38.2/glib/gmain.c:3774
#31 0x00007fb1d0ce5aac in QEventDispatcherGlib::processEvents (this=0xc178d0, flags=...) at kernel/qeventdispatcher_glib.cpp:426
#32 0x00007fb1d0c8cefb in QEventLoop::exec (this=this@entry=0x7fffd26bc530, flags=..., flags@entry=...) at kernel/qeventloop.cpp:212
#33 0x00007fb1d0c94526 in QCoreApplication::exec () at kernel/qcoreapplication.cpp:1188
#34 0x00007fb1d11b95ac in QGuiApplication::exec () at kernel/qguiapplication.cpp:1436
#35 0x00007fb1d1927ec5 in QApplication::exec () at kernel/qapplication.cpp:2745
#36 0x00007fb1d5386e93 in kdemain (argc=<optimized out>, argv=<optimized out>) at /var/tmp/portage/kde-base/plasma-workspace-9999/work/plasma-workspace-9999/klipper/main.cpp:51
#37 0x00007fb1d4fc9bf5 in __libc_start_main (main=0x400870 <main(int, char**)>, argc=1, ubp_av=0x7fffd26bc708, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fffd26bc6f8) at libc-start.c:258
#38 0x00000000004008a1 in _start ()
Comment 1 Martin Klapetek 2014-05-26 08:29:20 UTC
This happens when plasma is quitting or starting new?

And what does systemctl --user restart do exactly? I don't have a systemd to reproduce
Comment 2 Elias Probst 2014-05-26 14:55:28 UTC
Ok, some more details:

It happens when plasmashell is quitting and seems only to happen, when the shutdown was initiated via 'systemctl' which should actually just send a SIGTERM (the same as using 'killall plasmashell' which somehow doesn't seem to trigger the crash).
Using kquitapp5 doesn't seem to trigger the crash.

Klipper only crashes when it was running before plasmashell was started.
Starting plasmashell first, then klipper, then terminating plasmashell doesn't seem to crash klipper.

So here are some more details on how to reproduce this crash:
1. Ensure plasmashell isn't running
2. Ensure klipper isn't running
3. Start klipper
4. Start plasmashell (wait until it has fully initialized, it mostly doesn't happen when terminating plasmashell immediately but only after ~15 secs or more)
5. Stop plasmashell
→ klipper crashes

I'm still trying to find out how to reproduce this crash when sending a plain SIGTERM via 'killall plasmashell'. Will provide an update once I have more on this.
Comment 3 Elias Probst 2014-05-26 14:56:43 UTC
Oh, and probably relevant:
- the plasmashell.service doesn't have any specific 'kill' options set (see: http://www.freedesktop.org/software/systemd/man/systemd.kill.html)
- the plasmashell.service is available here: https://github.com/eliasp/plasma-workspace-units/blob/master/systemd/user/plasmashell.service
Comment 4 Martin Klapetek 2014-05-26 15:10:47 UTC
Thanks for the update.

I still cannot reproduce here. Which distro is that btw?
Comment 5 Elias Probst 2014-05-26 15:42:47 UTC
Running on Gentoo.

All KF5/Plasma components from the 'kde' overlay:
http://git.overlays.gentoo.org/gitweb/?p=proj/kde.git;a=summary

Qt 5.3.0 from the 'qt' overlay:
http://git.overlays.gentoo.org/gitweb/?p=proj/qt.git;a=summary

The plasma workspace is not started via 'startkde', but using my own systemd user-session units which are the first stepping stones towards getting proper systemd support into KF5/Plasma:
https://github.com/eliasp/plasma-workspace-units/ (still needs a lot of polish + work)

Are there any other applications which could behave similar to klipper here, so I could test them to see if I can reproduce this crash with any other KF5 application?
Comment 6 Martin Flöser 2014-05-26 16:09:41 UTC
> Are there any other applications which could behave similar to klipper here,
> so I could test them to see if I can reproduce this crash with any other
> KF5 application?

anyone using a status notifier and being ported to frameworks. I think that are 
not so many (kwalletmanager?), but there is a test application in 
frameworks/knotifications/tests.
Comment 7 Elias Probst 2015-01-05 13:21:28 UTC
I can't reproduce this anymore since Klipper provides now a native SNI applet.
Closing this bug therefore.

It might have also been related to bug#339763 (Missing signal handling in QCoreApplication).
Comment 8 Martin Klapetek 2015-01-05 13:22:59 UTC
I believe it might be #339707 rather. I plan to investigate that one today.