Bug 366320

Summary: Heavy CPU usage when pulseaudio fails to start
Product: [Plasma] plasma-pa Reporter: Chintalagiri Shashank <shashank>
Component: appletAssignee: David Rosca <nowrep>
Status: RESOLVED FIXED    
Severity: normal CC: plasma-bugs, shashank
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Kubuntu   
OS: Linux   
Latest Commit: Version Fixed In: 5.7.4
Sentry Crash Report:

Description Chintalagiri Shashank 2016-08-01 02:44:20 UTC
This bug occurs with the volume applet installed by default on Kubuntu 16.04.1. There doesn't seem to be an obvious way to retrieve the applet version. (As an aside, perhaps add an about screen to the applet configuration window?)

When pulseaudio fails to start / is not running, this applet seems to probe for a connection continuously. This pushes plasmashell CPU usage up to ~100% on one core (on a 4 core setup).

The applet should instead exponentially back-off on trying to reconnect, or at the very least it's retries should be throttled down to no more than 1 a second. 

Personally, I'd prefer it if the applet just gave up after a few tries and wait for a user to explicitly ask it to connect, but I understand why that may be less than ideal as a general solution.

Reproducible: Always

Steps to Reproduce:
1. Create a situation where pulseaudio will refuse to start. For me, I had PULSE_SERVER set to an external server via a pax11publish in one of my startup scripts, and the server is not available.
2. Log into a KDE session.


Actual Results:  
3. Look at CPU usage of plasmashell. Find that it's persistently using up a core.
4. Kill plasmashell and restart it from the command line. Find your screen fills up with pulseaudio failed to connect errors.
5. During this period, the speaker icon remains a dull red. (As another aside, I only realized that the red meant that there was a problem _after_ I managed to fix pulseaudio and saw the usual white icon)

Expected Results:  
A volume control applet should no require me to figure out ways to cool my CPU. That's just not cool.
Comment 1 David Rosca 2016-08-07 18:17:16 UTC
Git commit aa5efa1344ab34ffc580d73669b1eb2bd77d416c by David Rosca.
Committed on 07/08/2016 at 18:16.
Pushed by drosca into branch 'Plasma/5.7'.

Add 1s delay before trying to reconnect to pa
FIXED-IN: 5.7.4

M  +1    -1    src/context.cpp

http://commits.kde.org/plasma-pa/aa5efa1344ab34ffc580d73669b1eb2bd77d416c