Excessive CPU usage, even when the screen is turned off

Bug #1422898 reported by Niklas Wenzel on 2015-02-17
24
This bug affects 3 people
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

Niklas Wenzel (nikwen) wrote :

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

summary: - Excessive CPU usage, even when the device is turned off
+ Excessive CPU usage, even when the screen is turned off
description: updated
Niklas Wenzel (nikwen) on 2015-02-17
description: updated
description: updated
taiebot65 (dedreuil) wrote :

I confirm this behaviour had to restart the phone earlier

Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in unity8 (Ubuntu):
status: New → Confirmed
Albert Astals Cid (aacid) wrote :

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 :

"gdb" didn't return anything for Unity8.

Niklas Wenzel (nikwen) wrote :

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 :

sorry i gave you a wrong gdb command, should be
    sudo gdb attach `pidof unity8`
instead of
    sudo gdb `pidof unity8`

taiebot65 (dedreuil) wrote :

The unity8 log is full of the same output

QObject::starttimer: Timers cannot be started from another thread.
QObject::killTimer: Timers cannot be stopped from another thread.

Niklas Wenzel (nikwen) wrote :

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 :

Here's the output from the right gdb command now. ;)

Btw, thank you for looking into this. :)

Albert Astals Cid (aacid) wrote :

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::insert(int), if the moment you attach to unity8 the thread #0 doesn't have QListData::insert(int) in it, just quit gdb and try attaching again.

Niklas Wenzel (nikwen) wrote :

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 :

"""
QObject::starttimer: Timers cannot be started from another thread.
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 :

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 :

Thanks, Albert! :)

Albert Astals Cid (aacid) wrote :

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 :

Testing with

adb shell
sudo apt-add-repository ppa:ci-train-ppa-service/landing-021
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 :

Fixed in https://launchpad.net/ubuntu/+source/qtmir/0.4.4+15.04.20150220-0ubuntu1

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 :

Thank you very much for the fix. :)

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Duplicates of this bug

Other bug subscribers