[X2Go-Dev] Bug#526: Bug#526: Bug#526: Included PulseAudio consumes too much CPU when launched with high priority

Michael DePaulo mikedep333 at gmail.com
Mon Jun 30 16:11:03 CEST 2014


Hi Nable,

1. thank you for the patch. Command line testing shows that it does
lower the priority for PulseAudio 5.0 on Windows to "normal".
PulseAudio 1.1 ignores the argument and remains at "high" priority,
even though --help states that it recognizes the argument. 0.9.6
defaults to normal priority anyway. None of them refuse to start when
the argument is passed though.

2. I will incorporate your patch (it's only 1 line after all,) but
after talking with the PulseAudio developers, I will extend it so that
"normal" priority will only be set on Windows XP and Server 2003 /
Server 2003 R2. On Windows Vista / server 2008 and later, we will
continue to default to "high" priority.
(You are welcome to extend the patch to do this, or I will do extend
it later today or tomorrow.)

3. Right now I cannot test the patch with x2goclient because the
WIndows build VM has a networking problem. Mike#1 will fix that
problem sometime this week.

4. My testing reveals the following:
a. I am able to reproduce this bug. See setup #2 below.
b. I encountered a different bug with the virtual hardware (setup #1),
which is fixed by switching to a different sound driver (setup #2). I
will clone this bug report for my setup #1 bug.
c. This bug does not result in high CPU usage until audio is playing,
unlike my bug.
d. Manually  lowering the priority in task manager does appear to be a
valid workaround.

5. All my test details:

setup #1:
Note: default sound driver. I think I have a driverpacks.net driver
pack installed though, so it may not be the default driver for XP
without said driver pack.
Host & Hypervisor: Fedora 20 w/ KVM/virt-manager
VM accessed via: VirtViewer 0.6.0 64-bit for Windows w/ the SPICE protocol
Guest OS: Windows XP SP3 32-bit
vCPUs : 2 (host has 4 cores, core i5 750)
Sound setting in virt-manager: ac97
Sound adapter according to Windows: Intel(r) AC'97 Audio Controller -
SIgmaTel Codec
Driver Provider: SigmaTel
Driver Date: 12/20/2001
Driver Version: 5.10.0.7159

Results with: PulseaAudio 5.0, PulseAudio 1.1, and PulseAudio 0.9.6
launched from the command-line:
The combined CPU usage of pulseaudio.exe + "System" is very high, even
at normal priority, and the VM is extremely slow overall. This occurs
before any sound as playing. In other words, as the process is
started, the CPU usage immediately goes up and the VM immediately
becomes extremely slow. The combined CPU usage is always greater than
or equal to 1 CPU core.See #1 for notes on the behavior of the
priority. And yes, "System" CPU usage is normally 0% or just above 0%,
when pulseaudio.exe is not running.
The attached logs are from said results.

Results with x2goclient 4.0.2.0 (PulseAudio 5.0):
X2Go client GUI is extremely slow for same reason as on the
command-line. Cannot test any further.


setup #2
Note: same as before, except for a different sound driver:
Host & Hypervisor: Fedora 20 w/ KVM/virt-manager
VM accessed via: VirtViewer 0.6.0 64-bit for Windows w/ the SPICE protocol
Guest OS: Windows XP SP3 32-bit
vCPUs : 2 (host has 4 cores, core i5 750)
Sound setting in virt-manager: ac97
Sound adapter according to Windows: Intel(r) 82801AA AC'97 Audio Controller
Driver Provider: Microsoft
Driver Date: 7/1/2001
Driver Version: 5.1.2535.0

Results with: PulseaAudio 5.0, PulseAudio 1.1, and PulseAudio 0.9.6
launched from the command-line:
Whether I have normal priority or high priority, there is no high CPU
usage for either process, and no VM slowdown.

Results with x2goclient 4.0.2.0 (PulseAudio 5.0):
I reproduced this bug reported by Nable. I also observed that lowering
PulseAudio to normal fixes the problem. Only 1 vCPU was maxed out for
me (Nable had single core.) Also, unlike my problem with setup #1, the
VM is not extremely slow. Also, unlike my problem setup #1, CPU usage
is not high until audio is playing. Also, unlike my problem on
setup#1, "System's usage is 0% or a few % like normal.  There seems to
be a 1 second delay in audio, but that may be due to me accessing the
VM over Virt-Viewer. Also, the delay occurs at high priority.

-Mike#2

On Sun, Jun 29, 2014 at 11:47 AM, Nable 80
<nable.maininbox at googlemail.com> wrote:
> Hi Mike!
>
>> Our PA expert will take a look at that (I hope!).
> I've attached possible workaround, although I'm not sure if it's acceptable.
>
> _______________________________________________
> x2go-dev mailing list
> x2go-dev at lists.x2go.org
> http://lists.x2go.org/listinfo/x2go-dev
-------------- next part --------------
C:\pulseaudio-0.9.6-1.win32\pulseaudio-0.9.6>pulseaudio.exe --verbose --high-priority=no --exit-idle-time=-1 -n -F "c:\config.pa"
W: pulsecore/random.c: failed to get proper entropy. Falling back to seeding with current time.
W: pulsecore/core-util.c: secure directory creation not supported on Win32.
W: pulsecore/core.c: failed to allocate shared memory pool. Falling back to a normal memory pool.
Unable to convert, filtering
E: pulsecore/socket-server.c: socket(PF_INET6): Invalid argument
I: pulsecore/protocol-native.c: loading cookie from disk.
I: pulsecore/module.c: Loaded "module-native-protocol-tcp" (index: #0; argument: "port=4720").
Unable to convert, filtering
E: pulsecore/socket-server.c: socket(PF_INET6): Invalid argument
I: pulsecore/module.c: Loaded "module-esound-protocol-tcp" (index: #1; argument: "port=4721").
I: pulsecore/source.c: created 0 "wave_input" with sample spec "s16le 2ch 44100Hz"
I: pulsecore/sink.c: created 0 "wave_output" with sample spec "s16le 2ch 44100Hz"
I: pulsecore/source.c: created 1 "wave_output.monitor" with sample spec "s16le 2ch 44100Hz"
I: pulsecore/module.c: Loaded "module-waveout" (index: #2; argument: "").
I: daemon/main.c: Daemon startup complete.
I: daemon/main.c: Got signal SIGINT.
I: daemon/main.c: Exiting.
I: daemon/main.c: Daemon shutdown initiated.
I: pulsecore/module.c: Unloading "module-native-protocol-tcp" (index: #0).
I: pulsecore/module.c: Unloaded "module-native-protocol-tcp" (index: #0).
I: pulsecore/module.c: Unloading "module-esound-protocol-tcp" (index: #1).
I: pulsecore/module.c: Unloaded "module-esound-protocol-tcp" (index: #1).
I: pulsecore/module.c: Unloading "module-waveout" (index: #2).
I: pulsecore/sink.c: freed 0 "wave_output"
I: pulsecore/source.c: freed 1 "wave_output.monitor"
I: pulsecore/source.c: freed 0 "wave_input"
I: pulsecore/module.c: Unloaded "module-waveout" (index: #2).
I: daemon/main.c: Daemon terminated.

C:\pulseaudio-0.9.6-1.win32\pulseaudio-0.9.6>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: config.test.pa
Type: application/octet-stream
Size: 128 bytes
Desc: not available
URL: <http://lists.x2go.org/pipermail/x2go-dev/attachments/20140630/26f68d99/attachment-0001.obj>
-------------- next part --------------
C:\pulse1.1\pulse>pulseaudio.exe --verbose --high-priority=no --exit-idle-time=-1 -n -F "c:\config.pa"
I: [(null)] pulsecore/core-util.c: Successfully gained high priority class.
I: [(null)] daemon/main.c: This is PulseAudio 1.1
I: [(null)] daemon/main.c: Page size is 4096 bytes
I: [(null)] daemon/main.c: Machine ID is mothership-xp.
W: [(null)] pulsecore/core-util.c: Secure directory creation not supported on Win32.
I: [(null)] daemon/main.c: Using runtime directory C:\Documents and Settings\mike.DEPAULO\.pulse\mothership-xp-runtime.
W: [(null)] pulsecore/core-util.c: Secure directory creation not supported on Win32.
I: [(null)] daemon/main.c: Using state directory C:\Documents and Settings\mike.DEPAULO\.pulse.
I: [(null)] daemon/main.c: Using modules directory C:\pulse1.1\pulse\lib\pulse-1.1\modules.
I: [(null)] daemon/main.c: Running in system mode: no
W: [(null)] pulsecore/core-util.c: Secure directory creation not supported on Win32.
W: [(null)] pulsecore/pid.c: Stale PID file, overwriting.
I: [(null)] daemon/main.c: Fresh high-resolution timers available! Bon appetit!
W: [(null)] pulsecore/core.c: failed to allocate shared memory pool. Falling back to a normal memory pool.
I: [(null)] pulsecore/cpu-x86.c: CPU flags: CMOV MMX SSE SSE2 SSE3
I: [(null)] pulsecore/svolume_mmx.c: Initialising MMX optimized volume functions.
I: [(null)] pulsecore/remap_mmx.c: Initialising MMX optimized remappers.
I: [(null)] pulsecore/svolume_sse.c: Initialising SSE2 optimized volume functions.
I: [(null)] pulsecore/remap_sse.c: Initialising SSE2 optimized remappers.
I: [(null)] pulsecore/sconv_sse.c: Initialising SSE2 optimized conversions.
I: [(null)] pulsecore/svolume_orc.c: Initialising ORC optimized volume functions.
E: [(null)] pulsecore/socket-server.c: socket(PF_INET6): No error
I: [(null)] pulsecore/module.c: Loaded "module-native-protocol-tcp" (index: #0; argument: "port=4720 auth-cookie=C:\\.pulse-cookie").
E: [(null)] pulsecore/socket-server.c: socket(PF_INET6): No error
I: [(null)] pulsecore/module.c: Loaded "module-esound-protocol-tcp" (index: #1; argument: "port=4721").
I: [(null)] pulsecore/source.c: Created source 0 "wave_input" with sample spec s16le 2ch 44100Hz and channel map front-left,front-right
I: [(null)] pulsecore/source.c:     device.icon_name = "audio-input-microphone"
I: [(null)] pulsecore/sink.c: Created sink 0 "wave_output" with sample spec s16le 2ch 44100Hz and channel map front-left,front-right
I: [(null)] pulsecore/sink.c:     device.icon_name = "audio-card"
I: [(null)] pulsecore/source.c: Created source 1 "wave_output.monitor" with sample spec s16le 2ch 44100Hz and channel map front-left,front-right
I: [(null)] pulsecore/source.c:     device.description = "Monitor of wave_output"
I: [(null)] pulsecore/source.c:     device.class = "monitor"
I: [(null)] pulsecore/source.c:     device.icon_name = "audio-input-microphone"
I: [(null)] pulsecore/core-util.c: Successfully enabled THREAD_PRIORITY_TIME_CRITICAL scheduling for thread.
I: [(null)] pulsecore/module.c: Loaded "module-waveout" (index: #2; argument: "").
I: [(null)] daemon/main.c: Daemon startup complete.
I: [(null)] daemon/main.c: Got signal SIGINT.
I: [(null)] daemon/main.c: Exiting.
I: [(null)] daemon/main.c: Daemon shutdown initiated.
I: [(null)] pulsecore/module.c: Unloading "module-native-protocol-tcp" (index: #0).
I: [(null)] pulsecore/module.c: Unloaded "module-native-protocol-tcp" (index: #0).
I: [(null)] pulsecore/module.c: Unloading "module-esound-protocol-tcp" (index: #1).
I: [(null)] pulsecore/module.c: Unloaded "module-esound-protocol-tcp" (index: #1).
I: [(null)] pulsecore/module.c: Unloading "module-waveout" (index: #2).
I: [(null)] pulsecore/sink.c: Freeing sink 0 "wave_output"
I: [(null)] pulsecore/source.c: Freeing source 1 "wave_output.monitor"
I: [(null)] pulsecore/source.c: Freeing source 0 "wave_input"
I: [(null)] pulsecore/module.c: Unloaded "module-waveout" (index: #2).
I: [(null)] daemon/main.c: Daemon terminated.
W: [(null)] pulsecore/core-util.c: Secure directory creation not supported on Win32.

C:\pulse1.1\pulse>
-------------- next part --------------
C:\Program Files\x2goclient\pulse>pulseaudio.exe --verbose --high-priority=no --exit-idle-time=-1 -n -F "c:\config.pa"
I: [(null)] daemon/main.c: This is PulseAudio 5.0
I: [(null)] daemon/main.c: Page size is 4096 bytes
I: [(null)] daemon/main.c: Machine ID is mothership-xp.
W: [(null)] pulsecore/core-util.c: Secure directory creation not supported on Win32.
I: [(null)] daemon/main.c: Using runtime directory C:\Documents and Settings\mike.DEPAULO\.config\pulse\mothership-xp-runtime.
W: [(null)] pulsecore/core-util.c: Secure directory creation not supported on Win32.
I: [(null)] daemon/main.c: Using state directory C:\Documents and Settings\mike.DEPAULO\.config\pulse.
I: [(null)] daemon/main.c: Using modules directory C:\Program Files\x2goclient\pulse\lib\pulse-5.0\modules.
I: [(null)] daemon/main.c: Running in system mode: no
W: [(null)] pulsecore/core-util.c: Secure directory creation not supported on Win32.
I: [(null)] daemon/main.c: Fresh high-resolution timers available! Bon appetit!
W: [(null)] pulsecore/core.c: failed to allocate shared memory pool. Falling back to a normal memory pool.
I: [(null)] pulsecore/cpu-x86.c: CPU flags: CMOV MMX SSE SSE2 SSE3
I: [(null)] pulsecore/svolume_mmx.c: Initialising MMX optimized volume functions.
I: [(null)] pulsecore/remap_mmx.c: Initialising MMX optimized remappers.
I: [(null)] pulsecore/svolume_sse.c: Initialising SSE2 optimized volume functions.
I: [(null)] pulsecore/remap_sse.c: Initialising SSE2 optimized remappers.
I: [(null)] pulsecore/sconv_sse.c: Initialising SSE2 optimized conversions.
I: [(null)] pulsecore/svolume_orc.c: Initialising ORC optimized volume functions.
W: [(null)] pulsecore/core-util.c: Secure directory creation not supported on Win32.
E: [(null)] pulsecore/socket-server.c: socket(PF_INET6): No error
I: [(null)] pulsecore/module.c: Loaded "module-native-protocol-tcp" (index: #0; argument: "port=4720 auth-cookie=C:\.pulse-cookie").
W: [(null)] pulsecore/core-util.c: Secure directory creation not supported on Win32.
E: [(null)] pulsecore/socket-server.c: socket(PF_INET6): No error
I: [(null)] pulsecore/module.c: Loaded "module-esound-protocol-tcp" (index: #1; argument: "port=4721").
I: [(null)] pulsecore/source.c: Created source 0 "wave_input" with sample spec s16le 2ch 44100Hz and channel map front-left,front-right
I: [(null)] pulsecore/source.c:     device.description = "WaveIn on Microsoft Sound Mapper"
I: [(null)] pulsecore/source.c:     device.icon_name = "audio-input-microphone"
I: [(null)] pulsecore/sink.c: Created sink 0 "wave_output" with sample spec s16le 2ch 44100Hz and channel map front-left,front-right
I: [(null)] pulsecore/sink.c:     device.description = "WaveOut on Microsoft Sound Mapper"
I: [(null)] pulsecore/sink.c:     device.icon_name = "audio-card"
I: [(null)] pulsecore/source.c: Created source 1 "wave_output.monitor" with sample spec s16le 2ch 44100Hz and channel map front-left,front-right
I: [(null)] pulsecore/source.c:     device.description = "Monitor of WaveOut on Microsoft Sound Mapper"
I: [(null)] pulsecore/source.c:     device.class = "monitor"
I: [(null)] pulsecore/source.c:     device.icon_name = "audio-input-microphone"
I: [(null)] pulsecore/core-util.c: Successfully enabled THREAD_PRIORITY_TIME_CRITICAL scheduling for thread.
I: [(null)] pulsecore/module.c: Loaded "module-waveout" (index: #2; argument: "").
I: [(null)] daemon/main.c: Daemon startup complete.
I: [(null)] daemon/main.c: Got signal SIGINT.
I: [(null)] daemon/main.c: Exiting.
I: [(null)] daemon/main.c: Daemon shutdown initiated.
I: [(null)] pulsecore/module.c: Unloading "module-waveout" (index: #2).
I: [(null)] pulsecore/sink.c: Freeing sink 0 "wave_output"
I: [(null)] pulsecore/source.c: Freeing source 1 "wave_output.monitor"
I: [(null)] pulsecore/source.c: Freeing source 0 "wave_input"
I: [(null)] pulsecore/module.c: Unloaded "module-waveout" (index: #2).
I: [(null)] pulsecore/module.c: Unloading "module-esound-protocol-tcp" (index: #1).
I: [(null)] pulsecore/module.c: Unloaded "module-esound-protocol-tcp" (index: #1).
I: [(null)] pulsecore/module.c: Unloading "module-native-protocol-tcp" (index: #0).
I: [(null)] pulsecore/module.c: Unloaded "module-native-protocol-tcp" (index: #0).
I: [(null)] daemon/main.c: Daemon terminated.
W: [(null)] pulsecore/core-util.c: Secure directory creation not supported on Win32.

C:\Program Files\x2goclient\pulse>


More information about the x2go-dev mailing list