Excessive CPU usage, even when the screen is turned off
| Affects | Status | Importance | Assigned to | Milestone | |
|---|---|---|---|---|---|
| | qtmir (Ubuntu) |
Undecided
|
Albert Astals Cid | ||
Bug Description
Since mako image r102 (vivid-proposed), the CPU usage of Unity8 is very excessive and increasing over time.
After boot, the phone runs smooth but after some time it lags heavily.
As you can see from the attached output of the "top" command, Unity8 consumes 23% of CPU power when the screen is TURNED OFF (command run via adb). When the screen is on, this figure is much higher and sometimes rises up to 60%.
Related branches
- Gerry Boland: Approve on 2015-02-20
- PS Jenkins bot: Approve (continuous-integration) on 2015-02-20
-
Diff: 13 lines (+2/-1)1 file modifiedsrc/modules/Unity/Application/mirsurfaceitem.cpp (+2/-1)
| Niklas Wenzel (nikwen) wrote : | #1 |
| summary: |
- Excessive CPU usage, even when the device is turned off + Excessive CPU usage, even when the screen is turned off |
| description: | updated |
| description: | updated |
| description: | updated |
| taiebot65 (dedreuil) wrote : | #2 |
I confirm this behaviour had to restart the phone earlier
| Launchpad Janitor (janitor) wrote : | #3 |
Status changed to 'Confirmed' because the bug affects multiple users.
| Changed in unity8 (Ubuntu): | |
| status: | New → Confirmed |
| Albert Astals Cid (aacid) wrote : | #4 |
Phone has been running all night here and i can't reproduce the high cpu usage issue. Do you think is there something you do that triggers it?
Not sure it will help but when it's happening can you please do
sudo strace `pidof unity8`
let it run for a while, then Ctrl+C and attach the output
sudo gdb `pidof unity8`
thread apply all bt
and attach the output
| Niklas Wenzel (nikwen) wrote : | #5 |
"gdb" didn't return anything for Unity8.
| Niklas Wenzel (nikwen) wrote : | #6 |
Four seconds of the output of
sudo strace -Ff -tt -p `pidof unity8` 2>&1 | tee strace-unity8.log
My terminal window was really spammed. If you need more, I'll happily provide that.
| Albert Astals Cid (aacid) wrote : | #7 |
sorry i gave you a wrong gdb command, should be
sudo gdb attach `pidof unity8`
instead of
sudo gdb `pidof unity8`
| taiebot65 (dedreuil) wrote : | #8 |
The unity8 log is full of the same output
QObject:
QObject::killTimer: Timers cannot be stopped from another thread.
| Niklas Wenzel (nikwen) wrote : | #9 |
Screenshot of how the top output looks after some time (not touching the phone for a few seconds before I took the screenshot)...
| Niklas Wenzel (nikwen) wrote : | #10 |
Here's the output from the right gdb command now. ;)
Btw, thank you for looking into this. :)
| Albert Astals Cid (aacid) wrote : | #11 |
Niklas that is getting interesting, could you install the qtbase5-dbg package with apt-get and attach the backtrace again?
It's specially interesting the thread #0, that has that QListData:
| Niklas Wenzel (nikwen) wrote : | #12 |
I'll do that as soon as I have the time to do so, hopefully later this day. ;)
Meanwhile, I think I have found a method by which I can reproduce this bug very quickly.
I simply need to refresh a scope (e.g. the "Ubuntu News" scope) about 30 times and Unity8 gets to 15% of CPU usage. The more often I do it, the higher the value gets.
Maybe this works for you as well.
| Daniel d'Andrada (dandrader) wrote : | #13 |
"""
QObject:
QObject::killTimer: Timers cannot be stopped from another thread.
"""
This output in the logs is unrelated to this bug (ie, it's a different problem) as I'm getting it but no the high cpu usage.
| Albert Astals Cid (aacid) wrote : | #14 |
By refreshing a scope i seem to be able to increase the cpu, i'll investigate why
| Changed in unity8 (Ubuntu): | |
| assignee: | nobody → Albert Astals Cid (aacid) |
| Niklas Wenzel (nikwen) wrote : | #15 |
Thanks, Albert! :)
| Albert Astals Cid (aacid) wrote : | #16 |
we're leaking timers as crazy in unity8
start unity8 and it has 3 timers
now start unity8-dash and unity8 goes to 189 timers
now refresh the apps scope
and unity8 goes to 341 timers
which is very funny given unity8 doesn't really have anything to do with unity8-dash being refreshed
and it goes up with every dash refresh, eventually spending lots of cpu in just handling the timers
Need to verify where all those timers are coming from
| Changed in unity8 (Ubuntu): | |
| status: | Confirmed → In Progress |
| Timo Jyrinki (timo-jyrinki) wrote : | #17 |
Testing with
adb shell
sudo apt-add-repository ppa:ci-
sudo apt update
sudo apt dist-upgrade
Seems to show the linked branch greatly increases performance at least on my mako.
| Timo Jyrinki (timo-jyrinki) wrote : | #18 |
Fixed in https:/
Until new image is created, you can just:
adb shell
sudo apt update
sudo apt dist-upgrade
| affects: | unity8 (Ubuntu) → qtmir (Ubuntu) |
| Changed in qtmir (Ubuntu): | |
| status: | In Progress → Fix Released |
| Niklas Wenzel (nikwen) wrote : | #19 |
Thank you very much for the fix. :)


Here's a text file with the properly formatted output of the "top" command.