Bug 346855

Summary: kded5 100% cpu usage and blocks plasma
Product: [Frameworks and Libraries] frameworks-kded Reporter: Jaime Torres <jtamate>
Component: generalAssignee: David Faure <faure>
Status: RESOLVED WORKSFORME    
Severity: grave CC: christian.mails, jose, kdelibs-bugs-null, mursusoft
Priority: NOR    
Version First Reported In: unspecified   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Jaime Torres 2015-04-28 17:18:53 UTC
After some time, in a two users environment both running from the code compiled from sources with kdesrc-build, kded5 starts to use 100% of a cpu, and blocks plasma of an user.
I still do not know why it happens, therefore the only information I have is "gdb where" of the 100% cpu kded5. 
Fortunately, I've seen that killing it and starting it again, everything comes back to normal until the next lock.
compiled 2015-04-26

Reproducible: Always




#0  0x00007f7f5f13991c in _dl_update_slotinfo () at /lib64/ld-linux-x86-64.so.2
#1  0x00007f7f5f129145 in update_get_addr () at /lib64/ld-linux-x86-64.so.2
#2  0x00007f7f5d8f9792 in  () at /usr/lib64/libQt5Core.so.5
#3  0x00007f7f5db2bfca in  () at /usr/lib64/libQt5Core.so.5
#4  0x00007f7f5c6c528d in g_main_context_prepare () at /usr/lib64/libglib-2.0.so.0
#5  0x00007f7f5c6c5b03 in  () at /usr/lib64/libglib-2.0.so.0
#6  0x00007f7f5c6c5cec in g_main_context_iteration () at /usr/lib64/libglib-2.0.so.0
#7  0x00007f7f5db2c09c in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) ()
    at /usr/lib64/libQt5Core.so.5
#8  0x00007f7f5dad2ccb in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib64/libQt5Core.so.5
#9  0x00007f7f5f1884bb in KJob::exec() (this=0x25c3a00)
    at /g/5kde/frameworks/kcoreaddons/src/lib/jobs/kjob.cpp:189
#10 0x00007f7f39cbeb53 in PowerDevilUPowerBackend::init() () at /opt/kde5/lib64/plugins/kded_powerdevil.so
#11 0x00007f7f39c7176f in PowerDevil::Core::loadCore(PowerDevil::BackendInterface*) ()
    at /opt/kde5/lib64/libpowerdevilcore.so.2
#12 0x00007f7f39cb25fc in KDEDPowerDevil::init() () at /opt/kde5/lib64/plugins/kded_powerdevil.so
#13 0x00007f7f5db053c6 in QObject::event(QEvent*) () at /usr/lib64/libQt5Core.so.5
#14 0x00007f7f5ea15b5c in QApplicationPrivate::notify_helper(QObject*, QEvent*) (this=this@entry=0x22b17d0, receiver=receiver@entry=0x24f1f50, e=e@entry=0x24f1d60) at kernel/qapplication.cpp:3720
#15 0x00007f7f5ea1aa26 in QApplication::notify(QObject*, QEvent*) (this=0x7ffc03cb1220, receiver=0x24f1f50, e=0x24f1d60) at kernel/qapplication.cpp:3503
#16 0x00007f7f5dad4d65 in QCoreApplication::notifyInternal(QObject*, QEvent*) () at /usr/lib64/libQt5Core.so.5
#17 0x00007f7f5dad6bff in QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) ()
    at /usr/lib64/libQt5Core.so.5
#18 0x00007f7f5db2cc23 in  () at /usr/lib64/libQt5Core.so.5
#19 0x00007f7f5c6c5a04 in g_main_context_dispatch () at /usr/lib64/libglib-2.0.so.0
#20 0x00007f7f5c6c5c48 in  () at /usr/lib64/libglib-2.0.so.0
#21 0x00007f7f5c6c5cec in g_main_context_iteration () at /usr/lib64/libglib-2.0.so.0
#22 0x00007f7f5db2c09c in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) ()
    at /usr/lib64/libQt5Core.so.5
#23 0x00007f7f5dad2ccb in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib64/libQt5Core.so.5
#24 0x00007f7f5dada336 in QCoreApplication::exec() () at /usr/lib64/libQt5Core.so.5
#25 0x00007f7f5f33dfbc in kdemain(int, char**) (argc=1, argv=<optimized out>)
    at /g/5kde/frameworks/kded/src/kded.cpp:846
#26 0x000000000040091d in main(int, char**) (argc=<optimized out>, argv=<optimized out>)
    at /virtual/kde5/5build/frameworks/kded/src/kded5_dummy.cpp:3
Comment 1 Jaime Torres 2015-04-28 17:25:52 UTC
The blocking call of plasma.

5  0x00007f62aef2559d in dbus_connection_send_with_reply_and_block () at /lib64/libdbus-1.so.3
#6  0x00007f62b4370780 in  () at /usr/lib64/libQt5DBus.so.5
#7  0x00007f62b435d3c3 in QDBusConnection::call(QDBusMessage const&, QDBus::CallMode, int) const ()
    at /usr/lib64/libQt5DBus.so.5
#8  0x00007f62b573759e in KToolInvocation::startServiceInternal(char const*, QString const&, QStringList const&, QString*, QString*, int*, QByteArray const&, bool, QString const&) (this=
    0x7f62b5791cd0 <(anonymous namespace)::Q_QGS_s_self::innerFunction()::holder>, _function=<optimized out>, 
    _function@entry=0x7f62b577c87d "start_service_by_desktop_path", _name=..., URLs=..., error=error@entry=0x7ffd4b47e330, serviceName=serviceName@entry=0x0, pid=0x7ffd4b47e32c, startup_id=..., noWait=false, workdir=...)
    at /g/5kde/frameworks/kservice/src/kdeinit/ktoolinvocation.cpp:99
#9  0x00007f62b573815c in KToolInvocation::startServiceByDesktopPath(QString const&, QStringList const&, QString*, QString*, int*, QByteArray const&, bool) (_name=..., URLs=..., error=error@entry=0x7ffd4b47e330, serviceName=serviceName@entry=0x0, pid=pid@entry=0x7ffd4b47e32c, startup_id=..., noWait=false)
    at /g/5kde/frameworks/kservice/src/kdeinit/ktoolinvocation.cpp:190
#10 0x00007f62b1fea7a2 in KRun::runService(KService const&, QList<QUrl> const&, QWidget*, bool, QString const&, QByteArray const&) (_service=..., _urls=..., window=window@entry=
    0x0, tempFiles=tempFiles@entry=false, suggestedFileName=..., asn=...)
    at /g/5kde/frameworks/kio/src/widgets/krun.cpp:768
#11 0x00007f62b1feca0c in KRun::runUrl(QUrl const&, QString const&, QWidget*, bool, bool, QString const&, QByteArray const&) (u=..., _mimetype=..., window=0x0, tempFile=tempFile@entry=false, runExecutables=<optimized out>, suggestedFileName=..., asn=...) at /g/5kde/frameworks/kio/src/widgets/krun.cpp:231
#12 0x00007f62b1fecedd in KRun::foundMimeType(QString const&) (this=0x3fc64c0, type=...)
    at /g/5kde/frameworks/kio/src/widgets/krun.cpp:1272
#13 0x00007f62b1fe4c42 in KRun::mimeTypeDetermined(QString const&) (this=this@entry=0x3fc64c0, mimeType=...)
    at /g/5kde/frameworks/kio/src/widgets/krun.cpp:1220
#14 0x00007f62b1fe5ba7 in KRun::scanFile() (this=0x3fc64c0) at /g/5kde/frameworks/kio/src/widgets/krun.cpp:1058
#15 0x00007f62b1febe02 in KRun::init() (this=0x3fc64c0) at /g/5kde/frameworks/kio/src/widgets/krun.cpp:949
#16 0x00007f62b1fed6d1 in KRun::slotTimeout() (this=0x3fc64c0) at /g/5kde/frameworks/kio/src/widgets/krun.cpp:1100
#17 0x00007f62b1fed7d5 in KRun::qt_static_metacall(QObject*, QMetaObject::Call, int, void**) (_o=<optimized out>, _c=<optimized out>, _id=<optimized out>, _a=<optimized out>)
    at /virtual/kde5/5build/frameworks/kio/src/widgets/moc_krun.cpp:99
#18 0x00007f62b36145c1 in QMetaObject::activate(QObject*, int, int, void**) () at /usr/lib64/libQt5Core.so.5
#19 0x00007f62b36218f2 in QTimer::timerEvent(QTimerEvent*) () at /usr/lib64/libQt5Core.so.5
#20 0x00007f62b36151bc in QObject::event(QEvent*) () at /usr/lib64/libQt5Core.so.5
#21 0x00007f62b4979b5c in QApplicationPrivate::notify_helper(QObject*, QEvent*) (this=this@entry=0xf8f9a0, receiver=receiver@entry=0xc8a9ea0, e=e@entry=0x7ffd4b47ef10) at kernel/qapplication.cpp:3720
#22 0x00007f62b497ea26 in QApplication::notify(QObject*, QEvent*) (this=0x7ffd4b47f2e0, receiver=0xc8a9ea0, e=0x7ffd4b47ef10) at kernel/qapplication.cpp:3503
#23 0x00007f62b35e4d65 in QCoreApplication::notifyInternal(QObject*, QEvent*) () at /usr/lib64/libQt5Core.so.5
#24 0x00007f62b363baad in QTimerInfoList::activateTimers() () at /usr/lib64/libQt5Core.so.5
#25 0x00007f62b363bdd1 in  () at /usr/lib64/libQt5Core.so.5
#26 0x00007f62af1a9a04 in g_main_context_dispatch () at /usr/lib64/libglib-2.0.so.0
#27 0x00007f62af1a9c48 in  () at /usr/lib64/libglib-2.0.so.0
#28 0x00007f62af1a9cec in g_main_context_iteration () at /usr/lib64/libglib-2.0.so.0
Comment 2 Jaime Torres 2015-05-07 22:11:51 UTC
Got it again probably with a more useful backtrace.

#0  0x00007f188d6c421f in QMutex::unlock() (currentValue=<synthetic pointer>, newValue=0x0, expectedValue=0x1, _q_value=@0x7f188dce7a78: 0x0) at ../../src/corelib/arch/qatomic_x86.h:259
#1  0x00007f188d6c421f in QMutex::unlock() (currentValue=<synthetic pointer>, newValue=0x0, expectedValue=0x1, _q_value=@0x7f188dce7a78: 0x0) at ../../src/corelib/thread/qgenericatomic.h:175
#2  0x00007f188d6c421f in QMutex::unlock() (currentValue=<synthetic pointer>, newValue=0x0, expectedValue=0x1, this=this@entry=0x7f188dce7a78 <_q_ObjectMutexPool+376>) at ../../src/corelib/thread/qbasicatomic.h:272
#3  0x00007f188d6c421f in QMutex::unlock() (current=<synthetic pointer>, this=this@entry=0x7f188dce7a78 <_q_ObjectMutexPool+376>) at thread/qmutex.h:85
#4  0x00007f188d6c421f in QMutex::unlock() (this=this@entry=0x7f188dce7a78 <_q_ObjectMutexPool+376>)
    at thread/qmutex.cpp:264
#5  0x00007f188d8d5567 in QMetaObject::activate(QObject*, int, int, void**) (this=<synthetic pointer>)
    at ../../src/corelib/thread/qmutex.h:138
#6  0x00007f188d8d5567 in QMetaObject::activate(QObject*, int, int, void**) (sender=sender@entry=0x26c8b70, signalOffset=<optimized out>, local_signal_index=local_signal_index@entry=0, argv=argv@entry=0x0)
    at kernel/qobject.cpp:3712
#7  0x00007f188d8d5be7 in QMetaObject::activate(QObject*, QMetaObject const*, int, void**) (sender=sender@entry=0x26c8b70, m=m@entry=0x7f188dce1400 <QAbstractEventDispatcher::staticMetaObject>, local_signal_index=local_signal_index@entry=0, argv=argv@entry=0x0) at kernel/qobject.cpp:3582
#8  0x00007f188d951ee0 in QAbstractEventDispatcher::aboutToBlock() (this=this@entry=0x26c8b70)
    at .moc/moc_qabstracteventdispatcher.cpp:134
#9  0x00007f188d8fd06d in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) (this=
    0x26c8b70, flags=...) at kernel/qeventdispatcher_glib.cpp:405
#10 0x00007f188d8a3ccb in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) (this=0x7fff7c70d708, flags=...)
    at kernel/qeventloop.cpp:204
#11 0x00007f188c97d964 in KJob::exec() (this=0x2864410)
    at /g/5kde/frameworks/kcoreaddons/src/lib/jobs/kjob.cpp:189
#12 0x00007f186c8374f3 in PowerDevilUPowerBackend::init() () at /opt/kde5/lib64/plugins/kded_powerdevil.so
#13 0x00007f186c5f2d0c in PowerDevil::Core::loadCore(PowerDevil::BackendInterface*) ()
    at /opt/kde5/lib64/libpowerdevilcore.so.2
#14 0x00007f186c83062e in KDEDPowerDevil::init() () at /opt/kde5/lib64/plugins/kded_powerdevil.so
#15 0x00007f188d8d63c6 in QObject::event(QEvent*) (this=0x27b1c40, e=<optimized out>) at kernel/qobject.cpp:1245
#16 0x00007f188e565b5c in QApplicationPrivate::notify_helper(QObject*, QEvent*) (this=this@entry=
    0x2678c90, receiver=receiver@entry=0x27b1c40, e=e@entry=0x27c3510) at kernel/qapplication.cpp:3720
#17 0x00007f188e56aa26 in QApplication::notify(QObject*, QEvent*) (this=
    0x7fff7c70e708, receiver=0x27b1c40, e=0x27c3510) at kernel/qapplication.cpp:3503
#18 0x00007f188d8a5d65 in QCoreApplication::notifyInternal(QObject*, QEvent*) (this=0x7fff7c70e708, receiver=0x27b1c40, event=event@entry=0x27c3510) at kernel/qcoreapplication.cpp:935
#19 0x00007f188d8a7bff in QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) (event=0x27c3510, receiver=<optimized out>) at kernel/qcoreapplication.h:228
#20 0x00007f188d8a7bff in QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) (receiver=receiver@entry=0x0, event_type=event_type@entry=0, data=0x262d4a0) at kernel/qcoreapplication.cpp:1552
#21 0x00007f188d8a8238 in QCoreApplication::sendPostedEvents(QObject*, int) (receiver=receiver@entry=0x0, event_type=event_type@entry=0) at kernel/qcoreapplication.cpp:1410
#22 0x00007f188d8fdc23 in postEventSourceDispatch(GSource*, GSourceFunc, gpointer) (s=0x26c1690)
    at kernel/qeventdispatcher_glib.cpp:271
#23 0x00007f188ad58a04 in g_main_context_dispatch (context=0x7f18780016f0) at gmain.c:3111
#24 0x00007f188ad58a04 in g_main_context_dispatch (context=context@entry=0x7f18780016f0) at gmain.c:3710
#25 0x00007f188ad58c48 in g_main_context_iterate (context=context@entry=0x7f18780016f0, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at gmain.c:3781
Comment 3 mursusoft 2015-06-27 13:05:47 UTC
Same here! Something going on with both kded4 and kded5.

System: Kubuntu 15.04 with Plasma 5.3.1  Lenovo G505s (a10-5750m)

This happens when: 

Running Ktorrent (KF4) in either KDE or Unity! 30 min and system freezes and plasma shell crashes or Unity becomes unresponsive.

When listening music using spotify's web player with either up-to-date Chrome or Firefox. After awhile system becomes unresponsive and these + kded's have to be killed manually with console. (Both work fine when using Unity). 

I did some testing and it has to have something to do with kded4 and 5, because killing and restarting those system stabilizes for a moment until next freeze.
Comment 4 Christian 2015-09-04 13:27:36 UTC
Same happening here. kded5 5.12.0

Kubuntu 15.04
Comment 5 Jaime Torres 2015-09-04 15:31:38 UTC
I must say that with kded5 5.4 (from git), it has been 3 weeks without the 100% cpu use, but some plasma locks still happen (and I couldn't check why).
Comment 6 Jose Fernandez 2016-06-02 19:55:03 UTC
Hi!

On Gentoo, with KF 5.22 and Qt 5.5.1 I experience the 100% cpu from kded5, with the exact same behavior described in Comment #1.

Removing xrandr "solves" the problem. My hypothesis is that it gets stuck for some reason when trying to change the backlight using xrandr instead of the firmware.
Comment 7 Justin Zobel 2022-10-26 03:07:03 UTC
Thank you for reporting this bug in KDE software. As it has been a while since this issue was reported, can we please ask you to see if you can reproduce the issue with a recent software version?

If you can reproduce the issue, please change the status to "REPORTED" when replying. Thank you!
Comment 8 Jaime Torres 2022-10-26 14:12:43 UTC
I haven't experienced it in more than 4 years. Considered fixed.