Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pa_linux_alsa.c:3636: PaAlsaStreamComponent_BeginPolling: Assertion `ret == self->nfds' failed #268

Closed
PortAudio-admin opened this issue Jul 11, 2017 · 7 comments · Fixed by #344
Labels
linux Affects Linux P2 Priority: High src-alsa ALSA Host API /src/hostapi/alsa

Comments

@PortAudio-admin
Copy link
Collaborator

Issue created by Anonymous on Assembla

I am not sure if it is a PortAudio or an fldigi bug, but as a developer, I would say that if an assertion occurs inside the library, it is a bug of the library, unless we are dealing with some memory corruption or race conditions.

So, I can only reproduce the bug with fldigi. Reproducibility is 100%. Examples supplied with PortAudio and other PortAudio clients seem to work just fine.
Moreover, this happens only with Alsa 1.1.4.1 (and 1.1.4), but does not happen with the older 1.1.3.

The stacktrace is:

#0  0x00007ffff5a9802f in raise () from /lib64/libc.so.6
#1  0x00007ffff5a9942a in abort () from /lib64/libc.so.6
#2  0x00007ffff5a90e87 in ?? () from /lib64/libc.so.6
#3  0x00007ffff5a90f32 in __assert_fail () from /lib64/libc.so.6
#4  0x00007ffff7bb2273 in PaAlsaStreamComponent_BeginPolling (pfds=<optimized out>, self=<optimized out>)
    at /var/tmp/portage/media-libs/portaudio-19.06.00/work/portaudio/src/hostapi/alsa/pa_linux_alsa.c:3636
#5  0x00007ffff7bbfe15 in PaAlsaStreamComponent_BeginPolling (pfds=<optimized out>, self=<optimized out>)
    at /var/tmp/portage/media-libs/portaudio-19.06.00/work/portaudio/src/hostapi/alsa/pa_linux_alsa.c:3926
#6  PaAlsaStream_WaitForFrames (self=self@entry=0x7fffe4001a00, framesAvail=framesAvail@entry=0x7fffe99afe40,
    xrunOccurred=xrunOccurred@entry=0x7fffe99afe3c)
    at /var/tmp/portage/media-libs/portaudio-19.06.00/work/portaudio/src/hostapi/alsa/pa_linux_alsa.c:3797
#7  0x00007ffff7bc05ce in CallbackThreadFunc (userData=0x7fffe4001a00)
    at /var/tmp/portage/media-libs/portaudio-19.06.00/work/portaudio/src/hostapi/alsa/pa_linux_alsa.c:4269
#8  0x00007ffff7998374 in start_thread () from /lib64/libpthread.so.0
#9  0x00007ffff5b4db2f in clone () from /lib64/libc.so.6
@PortAudio-admin
Copy link
Collaborator Author

PortAudio-admin commented Oct 1, 2018

Comment by Anonymous on Assembla

pa_linux_alsa.c.txt

@PortAudio-admin
Copy link
Collaborator Author

Comment by Anonymous on Assembla

I had this happening to me as well, fairly intermittently (it could take up to six hours to trigger the bug).
It can also be triggered deliberately by taking too long in the audioCallback, i.e.:
std::this_thread::sleep_for(std::chrono::milliseconds(1000));

In both cases alsa_snd_pcm_poll_descriptors (pa_linux_alsa.c:3634) returns -32 (Broken Pipe) which fails the assert on line 3636.

Treating the Broken Pipe response from alsa as an xrun seems to be working. My attached pa_linux_alsa.c has my two edits marked with 'Chameleon edit' comments.

@PortAudio-admin
Copy link
Collaborator Author

Comment by Anonymous on Assembla

The attached pa_linux_alsa.c works for me (the original reporter of this issue). Thanks!

@jcelerier
Copy link
Contributor

jcelerier commented Oct 14, 2020

Can confirm still being hit by this even today (on archlinux) which uses pa_stable_v190600_20161030

@dvzrv do you think it'd be possible to add the attached above patch to the arch build ? (I can send a PR) - it makes it hard to have long-running art installs, I get the crash consistently in less than 24 hours

@dvzrv
Copy link

dvzrv commented Oct 14, 2020

@jcelerier preferably this would be a pull request towards this repository though (if the patch applies cleanly on top of the last stable release).

@daschuer
Copy link
Contributor

At Mixxx we have also a pending bug for this issue:
https://bugs.launchpad.net/mixxx/+bug/1903299

@daschuer
Copy link
Contributor

#344

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
linux Affects Linux P2 Priority: High src-alsa ALSA Host API /src/hostapi/alsa
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants