Running an app on the phone with the SDK gets python spinning on 100% cpu

Bug #1584093 reported by Michael Zanetti
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Client Developer Experience
Fix Released
Critical
Zoltan Balogh
qtcreator-plugin-ubuntu (Ubuntu)
Fix Released
Undecided
Benjamin Zeller

Bug Description

Run an app on the phone with the SDK. python will spin at 100% cpu permanently. This causes multiple issues:

* it's odd to debug your apps because they are slowed down a lot

* while developing with the device, battery drains faster than it charges, even though plugged to the PC.

* High power devices like turbo actually start to get *very* hot - I'm kinda worried of breaking it in the long run with this - especially the battery.

* when you unplug the device without first stopping the app, this gets stuck and requires a reboot.

Related branches

summary: - Running an app on the phone with the SDK gety python spinning on 100%
+ Running an app on the phone with the SDK gets python spinning on 100%
cpu
Revision history for this message
Pat McGowan (pat-mcgowan) wrote :

What are we using python for here btw?

Changed in canonical-developer-experience:
assignee: nobody → Zoltan Balogh (bzoltan)
importance: Undecided → Critical
Changed in qtcreator-plugin-ubuntu (Ubuntu):
assignee: nobody → Benjamin Zeller (zeller-benjamin)
Revision history for this message
Benjamin Zeller (zeller-benjamin) wrote :

Python is used here for several things:

1. Installing the uploaded click package
2. Setting up a debug environment
3. Executing the app using the hook specified in the RC
4. Redirecting the stdout and stderr of the application so it can be read by QtC
5. Waiting for the app to finish (using upstart events)
6. Cleaning up after the session is finished

Changed in canonical-developer-experience:
status: New → Confirmed
Changed in qtcreator-plugin-ubuntu (Ubuntu):
status: New → Confirmed
Revision history for this message
Benjamin Zeller (zeller-benjamin) wrote :

I can confirm the problem, and it seems it is due to us reading syslog and syslog
getting constant updates. ( tail -f /var/log/syslog).

The script needs to parse every syslog line for potential apparmor errors which is
expensive. There was another issue with listening on the pipes but it alone did not
solve the problem. Only completely disabling the parsing of syslog updates stops python
from taking up CPU.

The question is now do we want to drop reading syslog files or do we live with the CPU
consumption...

Another question is though why syslog is flooded with messages.

Revision history for this message
Michael Zanetti (mzanetti) wrote :

I've just tried this and I don't have a flooded syslog. I get in average some 4 messages per second in syslog, something nothing for a few seconds. Still python spins on 100%.

Revision history for this message
Benjamin Zeller (zeller-benjamin) wrote :

After some more debugging with Michael it seems the flooding is local to my device.
However we were able to confirm that the syslog code is causing python to spin on
100% CPU. I will try to figure out a different way to follow changes in the syslog file.

Changed in canonical-developer-experience:
status: Confirmed → Fix Committed
Changed in qtcreator-plugin-ubuntu (Ubuntu):
status: Confirmed → Fix Committed
Changed in qtcreator-plugin-ubuntu (Ubuntu):
status: Fix Committed → Fix Released
Changed in canonical-developer-experience:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.