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

Merged

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.
@davidebeatrici davidebeatrici merged commit 5452eef into mumble-voip:master Jan 15, 2025
15 checks passed
@davidebeatrici davidebeatrici deleted the alsa-handle-enodev branch January 15, 2025 20:31
@Krzmbrzl
Copy link
Member

💚 All backports created successfully

Status Branch Result
1.5.x

Questions ?

Please refer to the Backport tool documentation and see the Github Action logs for details

Krzmbrzl added a commit that referenced this pull request Jan 16, 2025
…and log spam on ALSA input device disconnection"
@Sophira
Copy link

Sophira commented Jan 19, 2025

Just wanted to say thank you for this - I've been using a local patch to do something similar for a while, since the log spam would fill up my disk space and wasn't easily recoverable since the log file in question was kept open by X11, so in the end I just commented out the errors. It looks like I may not to do this any more - thank you!

@davidebeatrici
Copy link
Member Author

You're welcome! I kindly ask you to submit a report if you encounter any issues in the future though, as we were unaware of this one until last week.

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.

4 participants