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

Fix infinite loop on broken ALSA pipes #934

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

cdellacqua
Copy link

When an ALSA interface ends up in an unrecoverable error state (e.g. device disconnected), the thread that runs input_stream_worker (or output_stream_worker depending on the type of stream) goes into an infinite loop due to the polling always returning an error.

This infinite loop causes calls to drop(stream) to hang indefinitely as the Drop implementation tries to join the polling thread.

Proposed solution

By adding a flag that's raised when a Stream is dropped, we can add an early exit condition to poll_descriptors_and_prepare_buffer that forces a return value of PollDescriptorsFlow::Return.

Testing

I successfully tested the fix on my local machine by unplugging the microphone while listening to it.

@cdellacqua
Copy link
Author

Note: the failed pipeline is wasm/emscripten-specific. The error looks quite similar to the one described in issue #810 but it's out of scope for this PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant