Bug 361702 - Kactivitymanagerd doesn't close on shutdown and triggers 90 sec shutdown delay in systemd
Summary: Kactivitymanagerd doesn't close on shutdown and triggers 90 sec shutdown dela...
Status: RESOLVED FIXED
Alias: None
Product: kactivitymanagerd
Classification: Plasma
Component: general (show other bugs)
Version: 5.6.2
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: Ivan Čukić
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-04-13 05:24 UTC by Raghavendra kamath
Modified: 2016-09-18 20:45 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
systemd shutdown log (1.37 KB, text/plain)
2016-05-02 15:32 UTC, Argy M
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Raghavendra kamath 2016-04-13 05:24:23 UTC
When I shutdown or reboot , systemd waits for some process to get terminated , and prints out " A stop job is running ..." message . when i enabled systemd debugging shell and checked the processes causing this with systemd-cgls i found the process is kactivitymanagerd that ic causing the delay.

If i end kactivitymanagerd process via system monitor and then reboot the machine reboots and get shutdown normally.

Reproducible: Always


Actual Results:  
kactivitymanagerd does not close it self on shutdown and reboot

Expected Results:  
kactivitymanagerd should close
Comment 1 Ulysses Ribeiro 2016-04-28 20:10:33 UTC
Same here.

Running pgrep -a -u username on the debug shell gives:
699 /usr/bin/kactivitymanagerd start-daemon

Then doing a pkill -u username, makes the shutdown continue immediately.
It seems kactivitymanagerd is not responding to SIGTERM.

Package version: 5.6.3

"kactivitymanagerd status" output:
The service is running, version: 7.0.0
Cleaning up...
Comment 2 Argy M 2016-05-02 15:32:54 UTC
Created attachment 98746 [details]
systemd shutdown log

I can confirm this on 5.6.3 too, on three different machines. It's been happening since 5.6.0. I am attaching the relevant part of the systemd shutdown log. The delay is short only because I have manually reduced the timeout.
Comment 3 Ivan Čukić 2016-05-02 16:15:49 UTC
It seems this happens since my attempt to subvert the QtSQL bug. Hmh, I'll have to think of something else then.

Thanks all :)
Comment 4 Mihai DONȚU 2016-06-06 22:40:27 UTC
I have the same issue and it's been happening for a while now. I just now got the time to take a closer look. It would appear the application exits while leaving taken semaphore in its path, leading to a deadlock when cleaning up:

#0  pthread_cond_wait () at ../sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185
#1  0x00007fbb9e5ebefa in QWaitConditionPrivate::wait (time=18446744073709551615, this=0xad6f20) at thread/qwaitcondition_unix.cpp:136
#2  QWaitCondition::wait (this=this@entry=0xad7298, mutex=mutex@entry=0xad7290, time=time@entry=18446744073709551615) at thread/qwaitcondition_unix.cpp:208
#3  0x00007fbb9e5e609b in QSemaphore::acquire (this=this@entry=0x7ffec6742f40, n=n@entry=1) at thread/qsemaphore.cpp:137
#4  0x00007fbb9e7b192f in QMetaObject::activate (sender=sender@entry=0xad8080, signalOffset=<optimized out>, local_signal_index=local_signal_index@entry=0, argv=argv@entry=0x7ffec6742fd0) at kernel/qobject.cpp:3698
#5  0x00007fbb9e7b1fc7 in QMetaObject::activate (sender=sender@entry=0xad8080, m=m@entry=0x7fbb9e9c0d60 <QObject::staticMetaObject>, local_signal_index=local_signal_index@entry=0, argv=argv@entry=0x7ffec6742fd0) at kernel/qobject.cpp:3595
#6  0x00007fbb9e7b206f in QObject::destroyed (this=this@entry=0xad8080, _t1=_t1@entry=0xad8080) at .moc/moc_qobject.cpp:213
#7  0x00007fbb9e7b8d65 in QObject::~QObject (this=<optimized out>, __in_chrg=<optimized out>) at kernel/qobject.cpp:913
#8  0x00007fbb92f83c39 in Breeze::Style::~Style() () from /usr/lib64/qt5/plugins/styles/breeze.so
#9  0x00007fbb9e7b1a0e in QtPrivate::QSlotObjectBase::call (a=0x7ffec67431d0, r=0xad8080, this=<optimized out>) at ../../include/QtCore/../../src/corelib/kernel/qobject_impl.h:124
#10 QMetaObject::activate (sender=sender@entry=0xad8450, signalOffset=<optimized out>, local_signal_index=local_signal_index@entry=0, argv=argv@entry=0x7ffec67431d0) at kernel/qobject.cpp:3715
#11 0x00007fbb9e7b1fc7 in QMetaObject::activate (sender=sender@entry=0xad8450, m=m@entry=0x7fbb9e9c0d60 <QObject::staticMetaObject>, local_signal_index=local_signal_index@entry=0, argv=argv@entry=0x7ffec67431d0) at kernel/qobject.cpp:3595
#12 0x00007fbb9e7b206f in QObject::destroyed (this=this@entry=0xad8450, _t1=_t1@entry=0xad8450) at .moc/moc_qobject.cpp:213
#13 0x00007fbb9e7b8d65 in QObject::~QObject (this=<optimized out>, __in_chrg=<optimized out>) at kernel/qobject.cpp:913
#14 0x00007fbb92f96ae7 in Breeze::StylePlugin::~StylePlugin() () from /usr/lib64/qt5/plugins/styles/breeze.so
#15 0x00007fbb9e781a23 in QLibraryPrivate::unload (this=this@entry=0xad1020, flag=flag@entry=QLibraryPrivate::UnloadSys) at plugin/qlibrary.cpp:551
#16 0x00007fbb9e7786b2 in QFactoryLoaderPrivate::~QFactoryLoaderPrivate (this=0xacf410, __in_chrg=<optimized out>) at plugin/qfactoryloader.cpp:88
#17 0x00007fbb9e7787e9 in QFactoryLoaderPrivate::~QFactoryLoaderPrivate (this=0xacf410, __in_chrg=<optimized out>) at plugin/qfactoryloader.cpp:91
#18 0x00007fbb9e7b9151 in QScopedPointerDeleter<QObjectData>::cleanup (pointer=<optimized out>) at ../../include/QtCore/../../src/corelib/tools/qscopedpointer.h:54
#19 QScopedPointer<QObjectData, QScopedPointerDeleter<QObjectData> >::~QScopedPointer (this=0x7fbb9f9fcae8 <(anonymous namespace)::Q_QGS_loader::innerFunction()::holder+8>, __in_chrg=<optimized out>) at ../../include/QtCore/../../src/corelib/tools/qscopedpointer.h:101
#20 QObject::~QObject (this=<optimized out>, __in_chrg=<optimized out>) at kernel/qobject.cpp:893
#21 0x00007fbb9e7777aa in QFactoryLoader::~QFactoryLoader (this=0x7fbb9f9fcae0 <(anonymous namespace)::Q_QGS_loader::innerFunction()::holder>, __in_chrg=<optimized out>) at plugin/qfactoryloader.cpp:226
#22 0x00007fbb9f5688c9 in (anonymous namespace)::Q_QGS_loader::Holder::~Holder (this=<optimized out>, __in_chrg=<optimized out>) at styles/qstylefactory.cpp:70
#23 0x00007fbb9d8d7b48 in __run_exit_handlers (status=0, listp=0x7fbb9dc35618 <__exit_funcs>, run_list_atexit=run_list_atexit@entry=true) at exit.c:82
#24 0x00007fbb9d8d7b95 in __GI_exit (status=<optimized out>) at exit.c:104
#25 0x00007fbba00ab3ca in KDBusService::KDBusService(QFlags<KDBusService::StartupOption>, QObject*) () from /usr/lib64/libKF5DBusAddons.so.5
#26 0x0000000000410a66 in main ()
(gdb) info threads
  Id   Target Id         Frame 
* 1    Thread 0x7fbba03d97c0 (LWP 5951) "kactivitymanage" pthread_cond_wait () at ../sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185

When logging out, three such processes remained hanged in the same place, but with different stacks. Here's another example:

#0  pthread_cond_wait () at ../sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185
#1  0x00007f2a63e2eefa in QWaitConditionPrivate::wait (time=18446744073709551615, this=0x18e6f60) at thread/qwaitcondition_unix.cpp:136
#2  QWaitCondition::wait (this=this@entry=0x18e12c8, mutex=mutex@entry=0x18e12c0, time=time@entry=18446744073709551615) at thread/qwaitcondition_unix.cpp:208
#3  0x00007f2a63e2909b in QSemaphore::acquire (this=this@entry=0x7ffde3f33140, n=n@entry=1) at thread/qsemaphore.cpp:137
#4  0x00007f2a63ff492f in QMetaObject::activate (sender=sender@entry=0x18e1140, signalOffset=<optimized out>, local_signal_index=local_signal_index@entry=0, argv=argv@entry=0x7ffde3f331d0) at kernel/qobject.cpp:3698
#5  0x00007f2a63ff4fc7 in QMetaObject::activate (sender=sender@entry=0x18e1140, m=m@entry=0x7f2a64203d60 <QObject::staticMetaObject>, local_signal_index=local_signal_index@entry=0, argv=argv@entry=0x7ffde3f331d0) at kernel/qobject.cpp:3595
#6  0x00007f2a63ff506f in QObject::destroyed (this=this@entry=0x18e1140, _t1=_t1@entry=0x18e1140) at .moc/moc_qobject.cpp:213
#7  0x00007f2a63ffbd65 in QObject::~QObject (this=<optimized out>, __in_chrg=<optimized out>) at kernel/qobject.cpp:913
#8  0x00007f2a587c6c39 in Breeze::Style::~Style() () from /usr/lib64/qt5/plugins/styles/breeze.so
#9  0x00007f2a63ff4a0e in QtPrivate::QSlotObjectBase::call (a=0x7ffde3f333d0, r=0x18e1140, this=<optimized out>) at ../../include/QtCore/../../src/corelib/kernel/qobject_impl.h:124
#10 QMetaObject::activate (sender=sender@entry=0x18e19f0, signalOffset=<optimized out>, local_signal_index=local_signal_index@entry=0, argv=argv@entry=0x7ffde3f333d0) at kernel/qobject.cpp:3715
#11 0x00007f2a63ff4fc7 in QMetaObject::activate (sender=sender@entry=0x18e19f0, m=m@entry=0x7f2a64203d60 <QObject::staticMetaObject>, local_signal_index=local_signal_index@entry=0, argv=argv@entry=0x7ffde3f333d0) at kernel/qobject.cpp:3595
#12 0x00007f2a63ff506f in QObject::destroyed (this=this@entry=0x18e19f0, _t1=_t1@entry=0x18e19f0) at .moc/moc_qobject.cpp:213
#13 0x00007f2a63ffbd65 in QObject::~QObject (this=<optimized out>, __in_chrg=<optimized out>) at kernel/qobject.cpp:913
#14 0x00007f2a587d9ae7 in Breeze::StylePlugin::~StylePlugin() () from /usr/lib64/qt5/plugins/styles/breeze.so
#15 0x00007f2a63fc4a23 in QLibraryPrivate::unload (this=this@entry=0x18da170, flag=flag@entry=QLibraryPrivate::UnloadSys) at plugin/qlibrary.cpp:551
#16 0x00007f2a63fbb6b2 in QFactoryLoaderPrivate::~QFactoryLoaderPrivate (this=0x18d84b0, __in_chrg=<optimized out>) at plugin/qfactoryloader.cpp:88
#17 0x00007f2a63fbb7e9 in QFactoryLoaderPrivate::~QFactoryLoaderPrivate (this=0x18d84b0, __in_chrg=<optimized out>) at plugin/qfactoryloader.cpp:91
#18 0x00007f2a63ffc151 in QScopedPointerDeleter<QObjectData>::cleanup (pointer=<optimized out>) at ../../include/QtCore/../../src/corelib/tools/qscopedpointer.h:54
#19 QScopedPointer<QObjectData, QScopedPointerDeleter<QObjectData> >::~QScopedPointer (this=0x7f2a6523fae8 <(anonymous namespace)::Q_QGS_loader::innerFunction()::holder+8>, __in_chrg=<optimized out>) at ../../include/QtCore/../../src/corelib/tools/qscopedpointer.h:101
#20 QObject::~QObject (this=<optimized out>, __in_chrg=<optimized out>) at kernel/qobject.cpp:893
#21 0x00007f2a63fba7aa in QFactoryLoader::~QFactoryLoader (this=0x7f2a6523fae0 <(anonymous namespace)::Q_QGS_loader::innerFunction()::holder>, __in_chrg=<optimized out>) at plugin/qfactoryloader.cpp:226
#22 0x00007f2a64dab8c9 in (anonymous namespace)::Q_QGS_loader::Holder::~Holder (this=<optimized out>, __in_chrg=<optimized out>) at styles/qstylefactory.cpp:70
#23 0x00007f2a6311ab48 in __run_exit_handlers (status=0, listp=0x7f2a63478618 <__exit_funcs>, run_list_atexit=run_list_atexit@entry=true) at exit.c:82
#24 0x00007f2a6311ab95 in __GI_exit (status=<optimized out>) at exit.c:104
#25 0x00000000004128a9 in QtPrivate::QFunctorSlotObject<main::{lambda(QString const&)#4}, 1, QtPrivate::List<QString const&>, void>::impl(int, QtPrivate::QSlotObjectBase*, QObject*, void**, bool*) ()
#26 0x00007f2a63ff4a0e in QtPrivate::QSlotObjectBase::call (a=0x7ffde3f33820, r=0x7ffde3f340b0, this=<optimized out>) at ../../include/QtCore/../../src/corelib/kernel/qobject_impl.h:124
#27 QMetaObject::activate (sender=0x7ffde3f340b0, signalOffset=<optimized out>, local_signal_index=<optimized out>, argv=<optimized out>) at kernel/qobject.cpp:3715
#28 0x00007f2a65ca4f02 in QDBusServiceWatcher::serviceRegistered(QString const&) () from /usr/lib64/libQt5DBus.so.5
#29 0x00007f2a65ca56cf in QDBusServiceWatcher::qt_static_metacall(QObject*, QMetaObject::Call, int, void**) () from /usr/lib64/libQt5DBus.so.5
#30 0x00007f2a65ca5aa0 in QDBusServiceWatcher::qt_metacall(QMetaObject::Call, int, void**) () from /usr/lib64/libQt5DBus.so.5
#31 0x00007f2a65c590b3 in QDBusConnectionPrivate::deliverCall(QObject*, int, QDBusMessage const&, QVector<int> const&, int) () from /usr/lib64/libQt5DBus.so.5
#32 0x00007f2a63ff57c1 in QObject::event (this=0x7ffde3f340b0, e=<optimized out>) at kernel/qobject.cpp:1256
#33 0x00007f2a64d3faac in QApplicationPrivate::notify_helper (this=<optimized out>, receiver=0x7ffde3f340b0, e=0x7f2a4c009040) at kernel/qapplication.cpp:3714
#34 0x00007f2a64d44cee in QApplication::notify (this=0x7ffde3f340c0, receiver=0x7ffde3f340b0, e=0x7f2a4c009040) at kernel/qapplication.cpp:3495
#35 0x00007f2a63fccd2a in QCoreApplication::notifyInternal2 (receiver=0x7ffde3f340b0, event=event@entry=0x7f2a4c009040) at kernel/qcoreapplication.cpp:1015
#36 0x00007f2a63fced7a in QCoreApplication::sendEvent (event=0x7f2a4c009040, receiver=<optimized out>) at kernel/qcoreapplication.h:227
#37 QCoreApplicationPrivate::sendPostedEvents (receiver=receiver@entry=0x0, event_type=event_type@entry=0, data=0x189b540) at kernel/qcoreapplication.cpp:1650
#38 0x00007f2a63fcf238 in QCoreApplication::sendPostedEvents (receiver=receiver@entry=0x0, event_type=event_type@entry=0) at kernel/qcoreapplication.cpp:1508
#39 0x00007f2a6401bd13 in postEventSourceDispatch (s=0x18c80b0) at kernel/qeventdispatcher_glib.cpp:270
#40 0x00007f2a5e598f57 in g_main_dispatch (context=0x7f2a540016f0) at /var/tmp/portage/dev-libs/glib-2.48.0-r1/work/glib-2.48.0/glib/gmain.c:3154
#41 g_main_context_dispatch (context=context@entry=0x7f2a540016f0) at /var/tmp/portage/dev-libs/glib-2.48.0-r1/work/glib-2.48.0/glib/gmain.c:3769
#42 0x00007f2a5e5991b0 in g_main_context_iterate (context=context@entry=0x7f2a540016f0, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at /var/tmp/portage/dev-libs/glib-2.48.0-r1/work/glib-2.48.0/glib/gmain.c:3840
#43 0x00007f2a5e59925c in g_main_context_iteration (context=0x7f2a540016f0, may_block=may_block@entry=1) at /var/tmp/portage/dev-libs/glib-2.48.0-r1/work/glib-2.48.0/glib/gmain.c:3901
#44 0x00007f2a6401bd8f in QEventDispatcherGlib::processEvents (this=0x18cde00, flags=...) at kernel/qeventdispatcher_glib.cpp:417
#45 0x00007f2a63fcbbba in QEventLoop::exec (this=this@entry=0x7ffde3f33f70, flags=..., flags@entry=...) at kernel/qeventloop.cpp:204
#46 0x00007f2a63fd36dc in QCoreApplication::exec () at kernel/qcoreapplication.cpp:1285
#47 0x0000000000410428 in main ()
(gdb) info threads
  Id   Target Id         Frame 
* 1    Thread 0x7f2a65c1c7c0 (LWP 5575) "kactivitymanage" pthread_cond_wait () at ../sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185
Comment 5 Ivan Čukić 2016-07-18 19:12:30 UTC
This should be fixed by latest systemd + latest kamd - I'm not going to close it until it is confirmed.