Bug 278897 - Amarok uses ~40% of CPU until main window is maximized
Summary: Amarok uses ~40% of CPU until main window is maximized
Status: RESOLVED FIXED
Alias: None
Product: amarok
Classification: Applications
Component: Context View/Lyrics (show other bugs)
Version: 2.4.3
Platform: Debian testing Linux
: NOR normal
Target Milestone: 2.5
Assignee: Amarok Developers
URL:
Keywords: regression, release_blocker
: 279144 281414 282006 287398 (view as bug list)
Depends on:
Blocks:
 
Reported: 2011-07-30 23:42 UTC by miguel.on.ito
Modified: 2011-11-28 11:45 UTC (History)
35 users (show)

See Also:
Latest Commit:
Version Fixed In: 2.5
Sentry Crash Report:


Attachments
4 different backtraces while in the CPU eating phase (9.97 KB, text/plain)
2011-09-05 21:19 UTC, Arno Rehn
Details

Note You need to log in before you can comment on or make changes to this bug.
Description miguel.on.ito 2011-07-30 23:42:09 UTC
Version:           2.4.2 (using KDE 4.6.5) 
OS:                Linux

When I start Amarok, and I do it minimized in the system tray, it starts to use a lot of CPU. It only goes normal when I click in the tray icon and main window is shown. After that, if I hide the main window again the problem doesnt occur anymore.

The problem happens with any of the phonon backends (xine, vlc or gstreamer).

Reproducible: Always

Steps to Reproduce:
· Start Amarok minimized in system tray



Actual Results:  
· Amarok uses 40% of CPU

Expected Results:  
· Amarok use of CPU not to be so high.

It happens on a fresh install of Amarok, with a new /home/user/.kde/share/apps/amarok folder.
Comment 1 Myriam Schweingruber 2011-07-31 23:20:40 UTC
I just wonder where you got Amarok 2.4.2 from, as we didn't release it but will release Amarok 2.4.3 instead in the coming days. 
Could you please try again with 2.4.3 once it is released and also run Amarok in debugging mode so we can see where the problem comes from. The necessary options are 'amarok -d --nofork'
Comment 2 Myriam Schweingruber 2011-08-02 12:04:38 UTC
*** Bug 279144 has been marked as a duplicate of this bug. ***
Comment 3 Myriam Schweingruber 2011-08-02 12:05:28 UTC
Confirmed by duplicate.
Comment 4 miguel.on.ito 2011-08-02 15:10:43 UTC
(In reply to comment #1)
> I just wonder where you got Amarok 2.4.2 from, as we didn't release it but will
> release Amarok 2.4.3 instead in the coming days. 
> Could you please try again with 2.4.3 once it is released and also run Amarok
> in debugging mode so we can see where the problem comes from. The necessary
> options are 'amarok -d --nofork'


yes, the same results with Amarok 2.4.3.

Here is the pastebin from debugging mode (last part)

http://paste.kde.org/105235/


please let me know if you need to know anything else.
Comment 5 valdikss 2011-08-02 15:17:17 UTC
I think my bug Bug 279144 has nothing to do with this bug. And by the way, amarok constantly writes something to the HDD when uses 100% cpu. Monitored with iotop.
Amarok uses 100% cpu even maximized for me. And not 40%, but 100%. There were no X errors in the log.
Comment 6 Florian Evers 2011-08-02 20:10:22 UTC
Same problem here, on two totally different boxes (both gentoo linux, one x86 the other amd64). Amarok 2.4.3 uses 100% of one CPU core until activated from systray the first time.
Comment 7 Martin Höher 2011-08-07 10:56:13 UTC
I can confirm this, too. I get the exactly same behaviour as described. My System: Fedora 15 x86_64, KDE 4.7.0, Amarok 2.4-Git.
Comment 8 Martin Kho 2011-08-11 14:54:04 UTC
Hi,

I experience this issue in Fedora 16:
* Amarok 2.4.3,
* KDE 4.7.0 
* qt-4.8.0-0.6.beta1.fc16.x86_64.

I don't experience it in Fedora 15:
* Amarok 2.4.3,
* KDE, 4.6.5 and
* qt-4.7.3-8.fc15.x86_64.

Another qt-4.8 issue?

Martin Kho
Comment 9 Florian Evers 2011-08-11 17:10:43 UTC
Hi,

@Martin Kho:
qt-4.7.2
amarok-2.4.3
kde-4.7.0

The box currently in front of me is a x86 Gentoo system. The bug appears each time. No qt-4.8.

Regards,
Florian
Comment 10 Martin Kho 2011-08-11 20:44:30 UTC
Hi,

I was indeed wrong, just booted into Fedora 15 and Amarok used ~40% cpu. Sorry for the noise :-)

Martin Kho
Comment 11 Txema 2011-08-12 17:05:17 UTC
Same here

Gentoo amd64
qt-4.7.3
KDE-4.7-0
Amarok-2.4.3
Comment 12 Sam Lade 2011-08-18 20:44:14 UTC
Here's the relevant section of a gdb trace, attached while Amarok's in the high-CPU tray minimised state, on latest git. It looks like it's getting stuck in a widget adjustment loop until they're actually displayed.

Thread 1 (Thread 0x7ff3dae4a7c0 (LWP 8745)):
#0  0x00007ff3c53be854 in ?? () from /usr/lib/kde4/plugins/styles/oxygen.so
#1  0x00007ff3d948ec3d in QAbstractScrollAreaPrivate::layoutChildren (this=0x24dee70) at widgets/qabstractscrollarea.cpp:399
#2  0x00007ff3d948fadd in QAbstractScrollArea::event (this=0x258d070, e=<value optimised out>) at widgets/qabstractscrollarea.cpp:924
#3  0x00007ff3d947c140 in QTextEdit::event (this=0x258d070, e=0x7fff4ea25db0) at widgets/qtextedit.cpp:1070
#4  0x00007ff3d900a9f4 in QApplicationPrivate::notify_helper (this=0x1613b70, receiver=0x258d070, e=0x7fff4ea25db0) at kernel/qapplication.cpp:4462
#5  0x00007ff3d900f3ba in QApplication::notify (this=<value optimised out>, receiver=0x258d070, e=0x7fff4ea25db0) at kernel/qapplication.cpp:4341
#6  0x00007ff3da9f6796 in KApplication::notify (this=0x7fff4ea281e0, receiver=0x258d070, event=0x7fff4ea25db0) at ../../kdeui/kernel/kapplication.cpp:311
#7  0x00007ff3d865049c in QCoreApplication::notifyInternal (this=0x7fff4ea281e0, receiver=0x258d070, event=0x7fff4ea25db0) at kernel/qcoreapplication.cpp:731
#8  0x00007ff3d90a861a in sendEvent (this=0x24dee70, x=<value optimised out>, y=<value optimised out>, w=<value optimised out>, h=<value optimised out>, isMove=false) at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:215
#9  QWidgetPrivate::setGeometry_sys (this=0x24dee70, x=<value optimised out>, y=<value optimised out>, w=<value optimised out>, h=<value optimised out>, isMove=false) at kernel/qwidget_x11.cpp:2637
#10 0x00007ff3d9057d2d in QWidget::resize (this=0x258d070, s=...) at kernel/qwidget.cpp:6845
#11 0x00007ff3d95f733e in QGraphicsProxyWidget::resizeEvent (this=0x24de690, event=0x7fff4ea268a0) at graphicsview/qgraphicsproxywidget.cpp:1464
#12 0x00007ff3d52aeff9 in Plasma::TextBrowser::resizeEvent (this=0x24de690, event=0x7fff4ea268a0) at ../../plasma/widgets/textbrowser.cpp:171
#13 0x00007ff3ad2ba853 in LyricsBrowser::resizeEvent (this=0x24de690, event=0x7fff4ea268a0) at /home/sam/devel/amarok/src/context/applets/lyrics/LyricsBrowser.cpp:146
#14 0x00007ff3d9632277 in QGraphicsWidget::event (this=0x24de690, event=0x7fff4ea268a0) at graphicsview/qgraphicswidget.cpp:1355
#15 0x00007ff3d95f9abb in QGraphicsProxyWidget::event (this=0x24de690, event=0x7fff4ea268a0) at graphicsview/qgraphicsproxywidget.cpp:926
#16 0x00007ff3d900a9f4 in QApplicationPrivate::notify_helper (this=0x1613b70, receiver=0x24de690, e=0x7fff4ea268a0) at kernel/qapplication.cpp:4462
#17 0x00007ff3d900f3ba in QApplication::notify (this=<value optimised out>, receiver=0x24de690, e=0x7fff4ea268a0) at kernel/qapplication.cpp:4341
#18 0x00007ff3da9f6796 in KApplication::notify (this=0x7fff4ea281e0, receiver=0x24de690, event=0x7fff4ea268a0) at ../../kdeui/kernel/kapplication.cpp:311
#19 0x00007ff3d865049c in QCoreApplication::notifyInternal (this=0x7fff4ea281e0, receiver=0x24de690, event=0x7fff4ea268a0) at kernel/qcoreapplication.cpp:731
#20 0x00007ff3d9633933 in sendEvent (this=0x24de690, rect=...) at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:215
#21 QGraphicsWidget::setGeometry (this=0x24de690, rect=...) at graphicsview/qgraphicswidget.cpp:404
#22 0x00007ff3d95f70b1 in QGraphicsProxyWidget::setGeometry (this=<value optimised out>, rect=<value optimised out>) at graphicsview/qgraphicsproxywidget.cpp:771
#23 0x00007ff3d963f350 in setGeometry (this=0x259f870, styleInfo=<value optimised out>, contentsGeometry=...) at graphicsview/qgridlayoutengine.cpp:701
#24 QGridLayoutEngine::setGeometries (this=0x259f870, styleInfo=<value optimised out>, contentsGeometry=...) at graphicsview/qgridlayoutengine.cpp:1096
#25 0x00007ff3d95f6273 in QGraphicsLinearLayout::setGeometry (this=<value optimised out>, rect=<value optimised out>) at graphicsview/qgraphicslinearlayout.cpp:518
#26 0x00007ff3d95f44aa in QGraphicsLayout::widgetEvent (this=0x259c050, e=<value optimised out>) at graphicsview/qgraphicslayout.cpp:366
#27 0x00007ff3d963217a in QGraphicsWidget::event (this=0x2586800, event=0x7fff4ea27170) at graphicsview/qgraphicswidget.cpp:1347
#28 0x00007ff3d900a9f4 in QApplicationPrivate::notify_helper (this=0x1613b70, receiver=0x2586800, e=0x7fff4ea27170) at kernel/qapplication.cpp:4462
#29 0x00007ff3d900f3ba in QApplication::notify (this=<value optimised out>, receiver=0x2586800, e=0x7fff4ea27170) at kernel/qapplication.cpp:4341
#30 0x00007ff3da9f6796 in KApplication::notify (this=0x7fff4ea281e0, receiver=0x2586800, event=0x7fff4ea27170) at ../../kdeui/kernel/kapplication.cpp:311
#31 0x00007ff3d865049c in QCoreApplication::notifyInternal (this=0x7fff4ea281e0, receiver=0x2586800, event=0x7fff4ea27170) at kernel/qcoreapplication.cpp:731
#32 0x00007ff3d9633933 in sendEvent (this=0x2586800, rect=...) at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:215
#33 QGraphicsWidget::setGeometry (this=0x2586800, rect=...) at graphicsview/qgraphicswidget.cpp:404
#34 0x00007ff3d96313a8 in QGraphicsWidget::resize (this=0x2586800, size=...) at graphicsview/qgraphicswidget.cpp:309
#35 0x00007ff3b42562bd in QGraphicsWidget::resize (this=0x2586800, w=16777215, h=93570) at /usr/include/qt4/QtGui/qgraphicswidget.h:111
#36 0x00007ff3b4255d00 in Context::VerticalAppletLayout::showAtIndex (this=0x23ae250, index=0) at /home/sam/devel/amarok/src/context/containments/verticallayout/VerticalAppletLayout.cpp:224
#37 0x00007ff3b42552f7 in Context::VerticalAppletLayout::refresh (this=0x23ae250) at /home/sam/devel/amarok/src/context/containments/verticallayout/VerticalAppletLayout.cpp:121
#38 0x00007ff3b425328a in Context::VerticalToolbarContainment::updateGeometry (this=0x2406b40) at /home/sam/devel/amarok/src/context/containments/verticallayout/VerticalToolbarContainment.cpp:124
#39 0x00007ff3d51a0934 in Plasma::Applet::flushPendingConstraintsEvents (this=0x2406b40) at ../../plasma/applet.cpp:1342
#40 0x00007ff3d51a165d in Plasma::Applet::timerEvent (this=0x2406b40, event=<value optimised out>) at ../../plasma/applet.cpp:2506
#41 0x00007ff3d86641c9 in QObject::event (this=0x2406b40, e=<value optimised out>) at kernel/qobject.cpp:1190
#42 0x00007ff3d96321bb in QGraphicsWidget::event (this=0x2406b40, event=0x7fff4ea27ef0) at graphicsview/qgraphicswidget.cpp:1423
#43 0x00007ff3d900a9f4 in QApplicationPrivate::notify_helper (this=0x1613b70, receiver=0x2406b40, e=0x7fff4ea27ef0) at kernel/qapplication.cpp:4462
#44 0x00007ff3d900f3ba in QApplication::notify (this=<value optimised out>, receiver=0x2406b40, e=0x7fff4ea27ef0) at kernel/qapplication.cpp:4341
#45 0x00007ff3da9f6796 in KApplication::notify (this=0x7fff4ea281e0, receiver=0x2406b40, event=0x7fff4ea27ef0) at ../../kdeui/kernel/kapplication.cpp:311
#46 0x00007ff3d865049c in QCoreApplication::notifyInternal (this=0x7fff4ea281e0, receiver=0x2406b40, event=0x7fff4ea27ef0) at kernel/qcoreapplication.cpp:731
#47 0x00007ff3d867df12 in sendEvent (this=0x1609d00) at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:215
#48 QTimerInfoList::activateTimers (this=0x1609d00) at kernel/qeventdispatcher_unix.cpp:604
#49 0x00007ff3d867acf4 in timerSourceDispatch (source=<value optimised out>) at kernel/qeventdispatcher_glib.cpp:184
#50 0x00007ff3d2429bcd in g_main_context_dispatch () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#51 0x00007ff3d242a3a8 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#52 0x00007ff3d242a639 in g_main_context_iteration () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#53 0x00007ff3d867b3ef in QEventDispatcherGlib::processEvents (this=0x14072e0, flags=<value optimised out>) at kernel/qeventdispatcher_glib.cpp:422
#54 0x00007ff3d90b44de in QGuiEventDispatcherGlib::processEvents (this=<value optimised out>, flags=<value optimised out>) at kernel/qguieventdispatcher_glib.cpp:204
#55 0x00007ff3d864f882 in QEventLoop::processEvents (this=<value optimised out>, flags=...) at kernel/qeventloop.cpp:149
#56 0x00007ff3d864fabc in QEventLoop::exec (this=0x7fff4ea28160, flags=...) at kernel/qeventloop.cpp:201
#57 0x00007ff3d8653ecb in QCoreApplication::exec () at kernel/qcoreapplication.cpp:1008
#58 0x000000000040cad6 in main (argc=1, argv=0x7fff4ea2a838) at /home/sam/devel/amarok/src/main.cpp:291
Comment 13 Philippe Cloutier 2011-08-18 21:43:35 UTC
I'm experiencing this under Debian testing with Amarok 2.4.3. This is most
certainly a regression from 2.4.3 (2.4.2). After asking on #amarok, Sam Lade
also reproduced the bug. He was the only one to try to reproduce.

The actual CPU usage depends on the CPU. For example, on an Intel Core i3, a
dual core CPU with Hyperthreading and therefore 4 "virtual cores", average CPU
usage will be 25% (100%/4). Also, it takes a bit of time (about a minute)
before CPU usage maximizes.

This is most certainly the same bug as #279144, just a different symptom. I can
reproduce both. To attempt summarizing:

There is no CPU waste if there are no applets in the Context view. If there are
applets, Amarok > 2.4.1 wastes CPU when it is started until the Context view is
shown.
Therefore, if the Context view is disabled, the waste lasts until the Context
view is enabled. If the Context view is enabled but Amarok starts minimized
(the most common case), CPU is wasted until Amarok is maximized. If the Context
view is enabled and Amarok starts maximized, no CPU waste happens.

Amarok will start minimized if the Show tray icon preference, enabled by
default, is enabled and it was closed minimized.
Therefore, the typical impact of this bug is that one core is fully loaded from
the time KDE is started until the user plays some music.

Thanks to Sam Lade for assistance.
Comment 14 valdikss 2011-08-19 03:03:25 UTC
(In reply to comment #13)
> The actual CPU usage depends on the CPU. For example, on an Intel Core i3, a
> dual core CPU with Hyperthreading and therefore 4 "virtual cores", average CPU
> usage will be 25% (100%/4). Also, it takes a bit of time (about a minute)
> before CPU usage maximizes.
Actually, it consumes 100% CPU, because if you have 4 cores then full load of your system is 400%.
Comment 15 Philippe Cloutier 2011-08-19 03:10:08 UTC
Well, given the CPU can't be used more than its full capacity, and that Amarok is not using the CPU to its full capacity, I guess it's normal to say it's below 100%. Whether 25% is representative I don't know (I have no idea how hyper-threading works). It's possible other tools will give you different number, but in any case, I'm referring to the consumption measures from KSysGuard.

Not that this matters, really.

2.4.4 sounds like a great target for this bug...
Comment 16 abyss.andrey 2011-08-20 05:32:17 UTC
I can confirm this bug.
My Amarok starts minimized with system and eats 100% of CPU.
It stops eat CPU after clicking on icon in system tray or after few minutes itself.
Comment 17 Philippe Cloutier 2011-08-24 21:58:47 UTC
Just to be clear, I am using the following WORKAROUND, which works:
1. Remove all applets from the context view.
2. Optionally, disable the context view to get the saved space back.

However, after step 1, if you ever want to restore applets, you will hit #280382.
Comment 18 Frederik Schwarzer 2011-09-05 17:00:34 UTC
*** Bug 281414 has been marked as a duplicate of this bug. ***
Comment 19 Arno Rehn 2011-09-05 21:18:02 UTC
I can confirm this. My backtraces look a little different from those of Sam. I'll attach them, maybe you can get some information out of them.
Comment 20 Arno Rehn 2011-09-05 21:19:04 UTC
Created attachment 63419 [details]
4 different backtraces while in the CPU eating phase
Comment 21 hamelg 2011-09-09 18:47:37 UTC
a possible workaround is to put that in a env file .kde/env/workaround.sh :

( sleep 10 && dbus-send --type=method_call --dest=org.kde.amarok /amarok/MainWindow com.trolltech.Qt.QWidget.showMinimized && dbus-send --type=method_call --dest=org.kde.amarok /amarok/MainWindow com.trolltech.Qt.QWidget.hide )&
Comment 22 Myriam Schweingruber 2011-09-16 11:22:56 UTC
*** Bug 282006 has been marked as a duplicate of this bug. ***
Comment 23 Emil Sedgh 2011-09-27 13:33:06 UTC
I can confirm this bug as well.
I have kdelibs from 4.7 branch, Qt 4.7.3 from debian (sid) packages and Amarok master.
Im also available to be poked on #kde-devel.
Comment 24 Marco Martin 2011-09-27 19:11:54 UTC
@Sam Lade: you could try to remove the lyrics plasmoid and see if the problem remains, if is still there remove the plasmoids one by one until it stops the behaviour, so at least would be a bit more clear if the problem is in a particular plasmoid or somewhere else
Comment 25 Sam Lade 2011-09-27 19:43:10 UTC
(In reply to comment #24)
> @Sam Lade: you could try to remove the lyrics plasmoid and see if the problem
> remains, if is still there remove the plasmoids one by one until it stops the
> behaviour, so at least would be a bit more clear if the problem is in a
> particular plasmoid or somewhere else

From speaking to people reporting this issue in #amarok, the problem is not linked to any particular plasmoid. Problem persists as long as any plasmoids are present. With no plasmoids, it doesn't occur.
I can retest this myself if you prefer.
Comment 26 Rex Dieter 2011-09-30 20:42:51 UTC
*** Bug 279144 has been marked as a duplicate of this bug. ***
Comment 27 Martin Kho 2011-11-04 13:33:21 UTC
Hi,

Saw that it always - for me at least - takes ~5 minutes before Amarok turns to normal operation.

May be this can give an extra clue. A time out routine somewhere?

Martin Kho
Comment 28 Mark Kretschmann 2011-11-05 07:53:30 UTC
OK, I can reproduce this as well with latest Git master. Gonna look into it.
Comment 29 Matěj Laitl 2011-11-05 13:38:44 UTC
That would be praiseworthy, Markey. Here are some backtraces I got when randomly interrupting Amarok when it is eating cpu. To me this all seems like Context::VerticalAppletLayout::refresh() is doing some work (showing children) it shouldn't be doing while it is not (yet) visible.


#0  QGraphicsWidget::boundingRect (this=0x34ef9d0) at graphicsview/qgraphicswidget.cpp:2341
#1  0x00007f0ecefcc74e in QGraphicsItem::sceneBoundingRect (this=<optimized out>) at graphicsview/qgraphicsitem.cpp:4811
#2  0x00007f0eceffb562 in QGraphicsScene::itemsBoundingRect (this=<optimized out>) at graphicsview/qgraphicsscene.cpp:1916
#3  0x00007f0eceffb707 in QGraphicsScene::sceneRect (this=0x2dfa610) at graphicsview/qgraphicsscene.cpp:1664
#4  0x00007f0ea8d12801 in Context::VerticalAppletLayout::showAtIndex (this=0x2e64c10, index=0)
    at /var/tmp/portage/media-sound/amarok-9999-r50/work/amarok-9999/src/context/containments/verticallayout/VerticalAppletLayout.cpp:177
#5  0x00007f0ea8d0f5d4 in Context::VerticalToolbarContainment::updateGeometry (this=0x2e1dbe0)
    at /var/tmp/portage/media-sound/amarok-9999-r50/work/amarok-9999/src/context/containments/verticallayout/VerticalToolbarContainment.cpp:124
#6  0x00007f0eca0b1dfc in Plasma::Applet::flushPendingConstraintsEvents (this=0x2e1dbe0)
    at /var/tmp/portage/kde-base/kdelibs-4.7.49.9999-r50/work/kdelibs-4.7.49.9999/plasma/applet.cpp:1348
#7  0x00007f0eca0b2b6d in Plasma::Applet::timerEvent (this=0x2e1dbe0, event=<optimized out>)
    at /var/tmp/portage/kde-base/kdelibs-4.7.49.9999-r50/work/kdelibs-4.7.49.9999/plasma/applet.cpp:2552
#8  0x00007f0ece04ca69 in QObject::event (this=0x2e1dbe0, e=<optimized out>) at kernel/qobject.cpp:1181
#9  0x00007f0ecf02f50b in QGraphicsWidget::event (this=0x2e1dbe0, event=0x7fff3ccd5ee0) at graphicsview/qgraphicswidget.cpp:1455
#10 0x00007f0ecea1dbb4 in QApplicationPrivate::notify_helper (this=0x241a190, receiver=0x2e1dbe0, e=0x7fff3ccd5ee0) at kernel/qapplication.cpp:4481
#11 0x00007f0ecea22768 in QApplication::notify (this=<optimized out>, receiver=0x2e1dbe0, e=0x7fff3ccd5ee0) at kernel/qapplication.cpp:4360
#12 0x00007f0ed0a29cd6 in KApplication::notify (this=0x7fff3ccd6220, receiver=0x2e1dbe0, event=0x7fff3ccd5ee0)
    at /var/tmp/portage/kde-base/kdelibs-4.7.49.9999-r50/work/kdelibs-4.7.49.9999/kdeui/kernel/kapplication.cpp:311
#13 0x00007f0ece0389cc in QCoreApplication::notifyInternal (this=0x7fff3ccd6220, receiver=0x2e1dbe0, event=0x7fff3ccd5ee0) at kernel/qcoreapplication.cpp:787
#14 0x00007f0ece0665c2 in sendEvent (event=0x7fff3ccd5ee0, receiver=<optimized out>) at kernel/qcoreapplication.h:215
#15 QTimerInfoList::activateTimers (this=0x24204d0) at kernel/qeventdispatcher_unix.cpp:603
#16 0x00007f0ece063314 in timerSourceDispatch (source=<optimized out>) at kernel/qeventdispatcher_glib.cpp:184
#17 0x00007f0ec7e861b3 in g_main_dispatch (context=0x2406c70) at gmain.c:2441



#0  0x00007f0ecd716b59 in __libc_writev (fd=8, vector=0x7fff3ccd5d00, count=3) at ../sysdeps/unix/sysv/linux/writev.c:56
#1  0x00007f0ec8369f31 in write_vec (count=0x7fff3ccd5c74, vector=0x7fff3ccd5c78, c=<optimized out>)
    at /var/tmp/portage/x11-libs/libxcb-1.7/work/libxcb-1.7/src/xcb_conn.c:156
#2  _xcb_conn_wait (c=0x24225f0, cond=<optimized out>, vector=0x7fff3ccd5c78, count=0x7fff3ccd5c74)
    at /var/tmp/portage/x11-libs/libxcb-1.7/work/libxcb-1.7/src/xcb_conn.c:339
#3  0x00007f0ec836a3a3 in _xcb_out_send (c=0x24225f0, vector=0x7fff3ccd5d00, count=3) at /var/tmp/portage/x11-libs/libxcb-1.7/work/libxcb-1.7/src/xcb_out.c:338
#4  0x00007f0ec836a434 in xcb_writev (c=0x24225f0, vector=<optimized out>, count=<optimized out>, requests=6)
    at /var/tmp/portage/x11-libs/libxcb-1.7/work/libxcb-1.7/src/xcb_out.c:286
#5  0x00007f0ecf5337b6 in _XSend (dpy=0x242af10, data=<optimized out>, size=<optimized out>)
    at /var/tmp/portage/x11-libs/libX11-1.4.4/work/libX11-1.4.4/src/xcb_io.c:494
#6  0x00007f0ecf533b19 in _XEventsQueued (dpy=0x242af10, mode=<optimized out>) at /var/tmp/portage/x11-libs/libX11-1.4.4/work/libX11-1.4.4/src/xcb_io.c:353
#7  0x00007f0ecf52430f in XEventsQueued (dpy=0x242af10, mode=2) at /var/tmp/portage/x11-libs/libX11-1.4.4/work/libX11-1.4.4/src/Pending.c:43
#8  0x00007f0eceac4260 in x11EventSourceDispatch (s=0x2407c40, callback=0, user_data=0x0) at kernel/qguieventdispatcher_glib.cpp:151
#9  0x00007f0ec7e861b3 in g_main_dispatch (context=0x2406c70) at gmain.c:2441



#0  QMetaObject::method (this=0x7f0ecf4cb0e0, index=54) at kernel/qmetaobject.cpp:779
#1  0x00007f0ece042164 in QMetaObject::invokeMethod (obj=0x2ff1820, member=<optimized out>, type=Qt::AutoConnection, ret=..., val0=..., val1=..., val2=..., val3=..., 
    val4=..., val5=..., val6=..., val7=..., val8=..., val9=...) at kernel/qmetaobject.cpp:1149
#2  0x00007f0ecef5a0b5 in invokeMethod (val9=..., val8=..., val7=..., val6=..., val5=..., val4=..., val3=..., val2=..., val1=..., val0=..., 
    member=0x7f0ecf0d3615 "updateGeometries", obj=<optimized out>) at ../../include/QtCore/../../src/corelib/kernel/qobjectdefs.h:426
#3  QTreeView::updateGeometries (this=0x2fd82f0) at itemviews/qtreeview.cpp:2685
#4  0x00007f0ecef62b61 in QTreeView::timerEvent (this=0x2fd82f0, event=0x7fff3ccd5ee0) at itemviews/qtreeview.cpp:1183
#5  0x00007f0ece04ca69 in QObject::event (this=0x2fd82f0, e=<optimized out>) at kernel/qobject.cpp:1181
#6  0x00007f0ecea6f745 in QWidget::event (this=0x2fd82f0, event=0x7fff3ccd5ee0) at kernel/qwidget.cpp:8754
#7  0x00007f0ecee05fe6 in QFrame::event (this=0x2fd82f0, e=0x7fff3ccd5ee0) at widgets/qframe.cpp:557
#8  0x00007f0ecee88143 in QAbstractScrollArea::event (this=0x2fd82f0, e=0x7fff3ccd5ee0) at widgets/qabstractscrollarea.cpp:996
#9  0x00007f0ecef1a57b in QAbstractItemView::event (this=0x2fd82f0, event=0x7fff3ccd5ee0) at itemviews/qabstractitemview.cpp:1564
#10 0x00007f0ecea1dbb4 in QApplicationPrivate::notify_helper (this=0x241a190, receiver=0x2fd82f0, e=0x7fff3ccd5ee0) at kernel/qapplication.cpp:4481
#11 0x00007f0ecea22768 in QApplication::notify (this=<optimized out>, receiver=0x2fd82f0, e=0x7fff3ccd5ee0) at kernel/qapplication.cpp:4360
#12 0x00007f0ed0a29cd6 in KApplication::notify (this=0x7fff3ccd6220, receiver=0x2fd82f0, event=0x7fff3ccd5ee0)
    at /var/tmp/portage/kde-base/kdelibs-4.7.49.9999-r50/work/kdelibs-4.7.49.9999/kdeui/kernel/kapplication.cpp:311
#13 0x00007f0ece0389cc in QCoreApplication::notifyInternal (this=0x7fff3ccd6220, receiver=0x2fd82f0, event=0x7fff3ccd5ee0) at kernel/qcoreapplication.cpp:787
#14 0x00007f0ece0665c2 in sendEvent (event=0x7fff3ccd5ee0, receiver=<optimized out>) at kernel/qcoreapplication.h:215
#15 QTimerInfoList::activateTimers (this=0x24204d0) at kernel/qeventdispatcher_unix.cpp:603
#16 0x00007f0ece063314 in timerSourceDispatch (source=<optimized out>) at kernel/qeventdispatcher_glib.cpp:184
#17 0x00007f0ec7e861b3 in g_main_dispatch (context=0x2406c70) at gmain.c:2441



#0  0x00007f0ecf01c485 in QGraphicsSceneEvent::QGraphicsSceneEvent (this=0x7fff3ccd3c60, dd=..., type=QEvent::GraphicsSceneResize)
    at graphicsview/qgraphicssceneevent.cpp:302
#1  0x00007f0ecf01d252 in QGraphicsSceneResizeEvent::QGraphicsSceneResizeEvent (this=0x7fff3ccd3c60) at graphicsview/qgraphicssceneevent.cpp:1553
#2  0x00007f0ecf030c10 in QGraphicsWidget::setGeometry (this=0x2febb30, rect=<optimized out>) at graphicsview/qgraphicswidget.cpp:400
#3  0x00007f0ecf03d014 in setGeometry (rect=..., this=0x3005990) at graphicsview/qgridlayoutengine.cpp:701
#4  QGridLayoutEngine::setGeometries (this=0x3006170, styleInfo=<optimized out>, contentsGeometry=...) at graphicsview/qgridlayoutengine.cpp:1096
#5  0x00007f0eceff23ec in QGraphicsLinearLayout::setGeometry (this=<optimized out>, rect=<optimized out>) at graphicsview/qgraphicslinearlayout.cpp:514
#6  0x00007f0eceff042a in QGraphicsLayout::widgetEvent (this=0x3005e80, e=<optimized out>) at graphicsview/qgraphicslayout.cpp:383
#7  0x00007f0ecf02f4cf in QGraphicsWidget::event (this=0x2fa3740, event=0x7fff3ccd4660) at graphicsview/qgraphicswidget.cpp:1379
#8  0x00007f0ecea1dbb4 in QApplicationPrivate::notify_helper (this=0x241a190, receiver=0x2fa3740, e=0x7fff3ccd4660) at kernel/qapplication.cpp:4481
#9  0x00007f0ecea22768 in QApplication::notify (this=<optimized out>, receiver=0x2fa3740, e=0x7fff3ccd4660) at kernel/qapplication.cpp:4360
#10 0x00007f0ed0a29cd6 in KApplication::notify (this=0x7fff3ccd6220, receiver=0x2fa3740, event=0x7fff3ccd4660)
    at /var/tmp/portage/kde-base/kdelibs-4.7.49.9999-r50/work/kdelibs-4.7.49.9999/kdeui/kernel/kapplication.cpp:311
#11 0x00007f0ece0389cc in QCoreApplication::notifyInternal (this=0x7fff3ccd6220, receiver=0x2fa3740, event=0x7fff3ccd4660) at kernel/qcoreapplication.cpp:787
#12 0x00007f0ecf030cae in sendEvent (event=0x7fff3ccd4660, receiver=0x2fa3740) at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:215
#13 QGraphicsWidget::setGeometry (this=0x2fa3740, rect=<optimized out>) at graphicsview/qgraphicswidget.cpp:407
#14 0x00007f0ecf03d014 in setGeometry (rect=..., this=0x350ba80) at graphicsview/qgridlayoutengine.cpp:701
#15 QGridLayoutEngine::setGeometries (this=0x2e19410, styleInfo=<optimized out>, contentsGeometry=...) at graphicsview/qgridlayoutengine.cpp:1096
#16 0x00007f0eceff23ec in QGraphicsLinearLayout::setGeometry (this=<optimized out>, rect=<optimized out>) at graphicsview/qgraphicslinearlayout.cpp:514
#17 0x00007f0eceff042a in QGraphicsLayout::widgetEvent (this=0x2e5efc0, e=<optimized out>) at graphicsview/qgraphicslayout.cpp:383
#18 0x00007f0ecf02f4cf in QGraphicsWidget::event (this=0x2e64c10, event=0x7fff3ccd5060) at graphicsview/qgraphicswidget.cpp:1379
#19 0x00007f0ecea1dbb4 in QApplicationPrivate::notify_helper (this=0x241a190, receiver=0x2e64c10, e=0x7fff3ccd5060) at kernel/qapplication.cpp:4481
#20 0x00007f0ecea22768 in QApplication::notify (this=<optimized out>, receiver=0x2e64c10, e=0x7fff3ccd5060) at kernel/qapplication.cpp:4360
#21 0x00007f0ed0a29cd6 in KApplication::notify (this=0x7fff3ccd6220, receiver=0x2e64c10, event=0x7fff3ccd5060)
    at /var/tmp/portage/kde-base/kdelibs-4.7.49.9999-r50/work/kdelibs-4.7.49.9999/kdeui/kernel/kapplication.cpp:311
#22 0x00007f0ece0389cc in QCoreApplication::notifyInternal (this=0x7fff3ccd6220, receiver=0x2e64c10, event=0x7fff3ccd5060) at kernel/qcoreapplication.cpp:787
#23 0x00007f0ecf030cae in sendEvent (event=0x7fff3ccd5060, receiver=0x2e64c10) at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:215
#24 QGraphicsWidget::setGeometry (this=0x2e64c10, rect=<optimized out>) at graphicsview/qgraphicswidget.cpp:407
#25 0x00007f0ea8d1280a in Context::VerticalAppletLayout::showAtIndex (this=0x2e64c10, index=0)
    at /var/tmp/portage/media-sound/amarok-9999-r50/work/amarok-9999/src/context/containments/verticallayout/VerticalAppletLayout.cpp:177
#26 0x00007f0ea8d0f5d4 in Context::VerticalToolbarContainment::updateGeometry (this=0x2e1dbe0)
    at /var/tmp/portage/media-sound/amarok-9999-r50/work/amarok-9999/src/context/containments/verticallayout/VerticalToolbarContainment.cpp:124
#27 0x00007f0eca0b1dfc in Plasma::Applet::flushPendingConstraintsEvents (this=0x2e1dbe0)
    at /var/tmp/portage/kde-base/kdelibs-4.7.49.9999-r50/work/kdelibs-4.7.49.9999/plasma/applet.cpp:1348
Comment 30 Bart Cerneels 2011-11-18 11:17:35 UTC
Summary from my testing so far:

* When amarok is minimized, high CPU on startup until mainwindow is shown.
* All applets removed: high CPU until window is shown.
* When context view is disabled, high CPU until CV is added to the layout again.

Does not seem to be related to any applet.
Comment 31 Attilio Scotolati 2011-11-22 14:17:49 UTC
I'm also experiencing this bug on OpenSuse 12.1, with amarok 2.4.60git.1321705210-71.1 from Playground.
Furthermore, if I try to start music playback while in minimized, high-cpu state, playback stops after one-two seconds, then after another 10 seconds or so amarok crashes, and DrKonqui doesn't show up. This is a backtrace with gdb:

#0  0x00007ffff4865d95 in raise () from /lib64/libc.so.6
#1  0x00007ffff48672ab in abort () from /lib64/libc.so.6
#2  0x00007ffff4e94f2d in __gnu_cxx::__verbose_terminate_handler() ()
   from /usr/lib64/libstdc++.so.6
#3  0x00007ffff4e930d6 in ?? () from /usr/lib64/libstdc++.so.6
#4  0x00007ffff4e93103 in std::terminate() () from /usr/lib64/libstdc++.so.6
#5  0x00007ffff4e93246 in __cxa_rethrow () from /usr/lib64/libstdc++.so.6
#6  0x00007ffff5ee0d56 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>)
    () from /usr/lib64/libQtCore.so.4
#7  0x00007ffff5ee4de7 in QCoreApplication::exec() ()
   from /usr/lib64/libQtCore.so.4
#8  0x000000000040987e in main (argc=4, argv=0x7fffffffdb88)
    at /usr/src/debug/amarok-2.4.60git.1321705210/src/main.cpp:310

A more complete output of this gdb session is at http://paste.kde.org/149486/
Those X errors are spawning endlessly, until i open the main window. Then, CPU usage goes back to normal, and i can start playback with no other issues, that's why I believe this behavior is related to this bug.

IIRC, with an older glibc this wasn't happening, OS uses 2.14.1, but I fear breaking my system if I revert that.

I have an Acer 4810TG, and I'm using the intel 4500MHD GPU, Mesa 7.11, kernel 3.1.0, desktop effects on (disabling them gave me the same crash, but later).
Comment 32 Martin Kho 2011-11-23 14:27:49 UTC
Hi,

While running top, I observe that when Amarok is active (hidden in the systemtray or maximized) both the dbus-daemon and udisk-daemon are permanently kept from sleeping (they use 0.7 - 1.3% CPU). Disabling the option Collections -> Watch folders for changes doesn't have any effect. No other application are keeping these daemons awake, in so far I've seen. May be this observation can be helpful in solving this issue?

Martin Kho

Btw. dbus-monitor doesn't show any useful info :-(
Comment 33 Sam Lade 2011-11-23 14:30:16 UTC
(In reply to comment #32)
> Hi,
> 
> While running top, I observe that when Amarok is active (hidden in the
> systemtray or maximized) both the dbus-daemon and udisk-daemon are permanently
> kept from sleeping (they use 0.7 - 1.3% CPU). Disabling the option Collections
> -> Watch folders for changes doesn't have any effect. No other application are
> keeping these daemons awake, in so far I've seen. May be this observation can
> be helpful in solving this issue?
> 
> Martin Kho
> 
> Btw. dbus-monitor doesn't show any useful info :-(

The dbus spam fixed in commit 8cc3fc7ab9f is likely responsible for the dbus CPU usage at least, and therefore unrelated to this issue.
Comment 34 nazgul17@gmail.com 2011-11-23 17:09:53 UTC
I experienced the same issue. After boot, when KDE is loaded, Amarok uses 100% cpu time. When I click on the icon it goes back to an acceptable cpu time.
Comment 35 Myriam Schweingruber 2011-11-25 08:00:15 UTC
*** Bug 287398 has been marked as a duplicate of this bug. ***
Comment 36 Matěj Laitl 2011-11-27 14:39:33 UTC
There's a patch that should fix this bug at https://git.reviewboard.kde.org/r/103271/

It awaits review from someone more knowledgeable about the touched code than me.
Comment 37 Matěj Laitl 2011-11-28 11:45:04 UTC
Git commit 79bd9a7c6777e3f5d4e723bc5d3b00e5d6fe532b by Matěj Laitl.
Committed on 27/11/2011 at 15:24.
Pushed by laitl into branch 'master'.

Fix infinite loop in context view eating CPU until main window is shown

We used to use _scene_ sceneRect in
VerticalToolbarContainment::updateGeometry() to update applets and
geometry, but that leaded to infinite loop (across mainloop) -
m_applets->setGeometry(), refresh() would enlarge _scene_ sceneRect by
a few pixels which would trigger updateGeometry() and so on...

We now use _view_ sceneRect to update geometry. Rick W. Chen discovered
some glitches in applet collapsing when this patch is applied, but he
has a patch for that in the works and this is more serious problem, so
pushing this.

REVIEW: 103271
BUG: 278897
FIXED-IN: 2.5

M  +1    -0    ChangeLog
M  +12   -1    src/context/containments/verticallayout/VerticalToolbarContainment.cpp

http://commits.kde.org/amarok/79bd9a7c6777e3f5d4e723bc5d3b00e5d6fe532b