Bug 97874 - PulseAudio hangs after the first stream is ended
Summary: PulseAudio hangs after the first stream is ended
Status: RESOLVED MOVED
Alias: None
Product: PulseAudio
Classification: Unclassified
Component: daemon (show other bugs)
Version: unspecified
Hardware: ARM Linux (All)
: medium normal
Assignee: pulseaudio-bugs
QA Contact: pulseaudio-bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-09-20 14:56 UTC by Vladimir Stackov
Modified: 2018-07-30 10:20 UTC (History)
2 users (show)

See Also:
i915 platform:
i915 features:


Attachments
strace -Tttyy -s 111111 -o pa.strace -f -p `pidof pulseaudio` (182.23 KB, application/x-xz)
2016-09-20 14:56 UTC, Vladimir Stackov
Details
daemon.pa (2.00 KB, text/plain)
2016-09-20 14:58 UTC, Vladimir Stackov
Details
daemon.conf (2.37 KB, text/plain)
2016-09-20 14:59 UTC, Vladimir Stackov
Details
pactl while paplay is hung (8.11 KB, text/plain)
2016-09-22 09:19 UTC, Vladimir Stackov
Details
PA server log with paplay (129.72 KB, text/plain)
2016-09-22 09:46 UTC, Vladimir Stackov
Details
PA server log with mpd as a client (119.53 KB, text/plain)
2016-09-22 09:47 UTC, Vladimir Stackov
Details

Description Vladimir Stackov 2016-09-20 14:56:25 UTC
Created attachment 126661 [details]
strace -Tttyy -s 111111 -o pa.strace -f -p `pidof pulseaudio`

Description:

PulseAudio hangs after hangs after the first input stream has ended.

Reproducibility: 95%

Steps to reproduce:

1. Setup new pulseaudio in system mode
2. Exec following:
# LANG=C PULSE_LOG_TIME=1 PULSE_LOG=4 paplay /usr/share/sounds/alsa/Noise.wav
3. Repeat step 2

Actual result:

# LANG=C PULSE_LOG_TIME=1 PULSE_LOG=4 paplay /usr/share/sounds/alsa/Noise.wav
(   0.000|   0.000) Parsing configuration file '/etc/pulse/client.conf'
(   0.002|   0.002) Using shared memory pool with 1024 slots of size 64.0 KiB each, total size is 64.0 MiB, maximum usable slot size is 65496
(   0.003|   0.001) Not doing autospawn since we are root.
(   0.004|   0.000) Trying to connect to /run/user/0/pulse/native...
(   0.005|   0.000) connect(): No such file or directory (2)
(   0.005|   0.000) Trying to connect to /var/run/pulse/native...
(   0.007|   0.002) SHM possible: yes
(   0.010|   0.002) Protocol version: remote 30, local 30
(   0.011|   0.000) Negotiated SHM: no
(  30.057|  30.045) Failed to drain stream: Timeout

Expected result:

# LANG=C PULSE_LOG_TIME=1 PULSE_LOG=4 paplay /usr/share/sounds/alsa/Noise.wav
(   0.000|   0.000) Parsing configuration file '/etc/pulse/client.conf'
(   0.002|   0.002) Using shared memory pool with 1024 slots of size 64.0 KiB each, total size is 64.0 MiB, maximum usable slot size is 65496
(   0.003|   0.001) Not doing autospawn since we are root.
(   0.004|   0.000) Trying to connect to /run/user/0/pulse/native...
(   0.004|   0.000) connect(): No such file or directory (2)
(   0.005|   0.000) Trying to connect to /var/run/pulse/native...
(   0.006|   0.001) SHM possible: yes
(   0.009|   0.002) Protocol version: remote 30, local 30
(   0.009|   0.000) Negotiated SHM: no

Additional info:

Sometimes PA accepts second stream without any timeouts but I can't find any particular conditions in which it was happening.
While PA is in a hang I can still use HTTP/CLI protocols (pactl, Web UI).

Please note that PA system mode is because because I want to use my RPi device as a network media player.

I'm using Fedora 23 on RPi 2 and here are some details:

# cat /etc/fedora-release 
Fedora release 23 (Twenty Three)

# cat /proc/version 
Linux version 4.1.16-v7+ (dc4@dc4-XPS13-9333) (gcc version 4.8.3 20140303 (prerelease) (crosstool-NG linaro-1.13.1+bzr2650 - Linaro GCC 2014.03) ) #833 SMP Wed Jan 27 14:32:22 GMT 2016

# rpm -qa | grep pulse
pulseaudio-libs-7.1-1.fc23.1.armv7hl
pulseaudio-7.1-1.fc23.1.armv7hl
pulseaudio-utils-7.1-1.fc23.1.armv7hl

# gdb -p `pidof pulseaudio` -ex 'thr a a bt f' #while PA in hang
[..]
#0  0x767f1d54 in ppoll () from /lib/libc.so.6
No symbol table info available.
#1  0x76ef4c94 in pa_rtpoll_run () from /lib/libpulsecore-7.1.so
No symbol table info available.
#2  0x71e9228c in thread_func () from /usr/lib/pulse-7.1/modules/libalsa-util.so
No symbol table info available.
#3  0x76d20940 in internal_thread_func () from /usr/lib/pulseaudio/libpulsecommon-7.1.so
No symbol table info available.
#4  0x7694f0fc in start_thread () from /lib/libpthread.so.0
No symbol table info available.
#5  0x767fe370 in ?? () from /lib/libc.so.6
No symbol table info available.
Backtrace stopped: previous frame identical to this frame (corrupt stack?)

Thread 1 (Thread 0x76232000 (LWP 3064)):
#0  0x767f1d54 in ppoll () from /lib/libc.so.6
No symbol table info available.
#1  0x76e8d3f0 in pa_mainloop_poll () from /lib/libpulse.so.0
No symbol table info available.
#2  0x76e8da90 in pa_mainloop_iterate () from /lib/libpulse.so.0
No symbol table info available.
#3  0x76e8db68 in pa_mainloop_run () from /lib/libpulse.so.0
No symbol table info available.
#4  0x54b197bc in main ()
No symbol table info available.

I've also attached a complete output of strace and all related configs.

Thanks for any suggestions!
Comment 1 Vladimir Stackov 2016-09-20 14:58:32 UTC
Created attachment 126662 [details]
daemon.pa
Comment 2 Vladimir Stackov 2016-09-20 14:59:25 UTC
Created attachment 126663 [details]
daemon.conf
Comment 3 Tanu Kaskinen 2016-09-21 09:08:37 UTC
Sounds similar to https://bugs.freedesktop.org/show_bug.cgi?id=97627

The server clearly isn't hung, if pactl keeps working. It seems like something goes wrong in the audio streaming part. Can you attach the output of "pactl list" while paplay is hung?
Comment 4 Tanu Kaskinen 2016-09-21 09:16:17 UTC
Also, can you try "paplay -v" with some longer file? The -v option will increase verbosity, and you'll get a time display. Does the file play? Does the time display progress beyond 0 seconds? Does paplay hang at the end of the file? "Failed to drain stream" may mean that the problem happens when draining, but if the file is short, we may issue the drain command before anything has played, so the problem may not be directly related to draining.
Comment 5 Vladimir Stackov 2016-09-22 09:19:15 UTC
Created attachment 126723 [details]
pactl while paplay is hung
Comment 6 Vladimir Stackov 2016-09-22 09:31:57 UTC
>Also, can you try "paplay -v" with some longer file? The -v option will increase verbosity, and you'll get a time display. Does the file play?
It plays the first time and no sound comes out of my RPi the second time.

>Does the time display progress beyond 0 seconds?
Yes.

>Does paplay hang at the end of the file?
No, it hangs right after the first second, e.g.
>(   0.043|   0.017) Stream started.
>Time: 1.097 sec; Latency: 1992251 usec
boom! freeze here, or
>(   0.065|   0.011) Stream started.
>Time: 1.021 sec; Latency: 386548 usec.

>"Failed to drain stream" may mean that the problem happens when draining, but if the file is short, we may issue the drain command before anything has played, so the problem may not be directly related to draining.
I've tried to play a file with length above 1 minute with the same result.
Comment 7 Vladimir Stackov 2016-09-22 09:46:33 UTC
Created attachment 126726 [details]
PA server log with paplay
Comment 8 Vladimir Stackov 2016-09-22 09:47:42 UTC
Created attachment 126727 [details]
PA server log with mpd as a client
Comment 9 Tanu Kaskinen 2016-09-30 09:19:41 UTC
One explanation could be that requests for more data don't reach the client for some reason. There's a fix for one of such case here: https://cgit.freedesktop.org/pulseaudio/pulseaudio/commit/?id=eeec52caa0622504f7a0d065dd61db1dbf5a9569

You could try to install pulseaudio from the newest code from git. If that's not feasible (or it doesn't help), I can try to install Fedora on Raspi 2 myself at some point to duplicate your setup (I don't expect to have time for that in the near future, though).
Comment 10 Vladimir Stackov 2016-10-24 13:03:15 UTC
I've rebuilt PA from pulseaudio-7.1-1.fc23.1.src.rpm [1] with your patch -- no success, paplay still hangs after the first second.

Maybe I can provide some additional information without diving into PA source?
Thanks!

[1] http://mirror.yandex.ru/fedora/linux/updates/23/SRPMS/p/pulseaudio-7.1-1.fc23.1.src.rpm
Comment 11 Tanu Kaskinen 2016-10-25 14:07:27 UTC
(In reply to Vladimir Stackov from comment #10)
> Maybe I can provide some additional information without diving into PA
> source?

I don't know what that information could be, sorry.
Comment 12 GitLab Migration User 2018-07-30 10:20:58 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/issues/364.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.