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(client): Infinite loop and log spam on ALSA input device disconnection #6702

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

Conversation

davidebeatrici
Copy link
Member

@davidebeatrici davidebeatrici commented Jan 14, 2025

A user reported that sometimes the client log gets spammed with repeated messages such as:

<W>2025-01-10 10:24:10.638 ALSAAudioInput: No such device: No such device

The error corresponds to ENODEV (19), which we treat like any other.
Since it's unrecoverable, the code gets stuck in a full speed loop until the audio engine is stopped.

This commit:

  1. Switches from snd_pcm_prepare() to snd_pcm_recover(), which is specifically designed to recover streams.
  2. Breaks the loop if the error is not one of the only three recoverable (EINTR, EPIPE, ESTRPIPE). Example log:

<W>2025-01-14 06:16:44.494 ALSAAudioInput encountered unrecoverable error: File descriptor in bad state -> exiting...

Please note that also ALSAAudioOutput doesn't explicitly handle fatal errors in its loop, but it shouldn't run "infinitely" at full speed because poll-based.

src/mumble/ALSAAudio.cpp Show resolved Hide resolved
src/mumble/ALSAAudio.cpp Show resolved Hide resolved
src/mumble/ALSAAudio.cpp Show resolved Hide resolved
…ction

A user reported that sometimes the client log gets spammed with repeated messages such as:

<W>2025-01-10 10:24:10.638 ALSAAudioInput: No such device: No such device

The error corresponds to ENODEV (19), which we treat like any other.
Since it's unrecoverable, the code gets stuck in a full speed loop until the audio engine is stopped.

This commit:

1. Switches from snd_pcm_prepare() to snd_pcm_recover(), which is specifically designed to recover streams.
2. Breaks the loop if the error is not one of the only three recoverable (EINTR, EPIPE, ESTRPIPE). Example log:

<W>2025-01-14 06:16:44.494 ALSAAudioInput encountered unrecoverable error: File descriptor in bad state -> exiting...

Please note that also ALSAAudioOutput doesn't explicitly handle fatal errors in its loop, but it shouldn't run "infinitely" at full speed because poll-based.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants