Conversation
…annot lock the mic/sink On Linux the feedback path opens a cpal output stream and waits with sink.sleep_until_end(). If the device wedges (ALSA keeps a stale open handle), that call parks the worker thread forever while the stream keeps the device output side locked: PipeWire (or any other consumer) then gets EBUSY on the default sink for as long as the app lives, so e.g. system audio and the browser cannot open the sink at all. Poll for completion with a 30 s hard cap instead. Returning early drops the sink and the output stream, releasing the ALSA handle; a wedged device no longer blocks the rest of the audio stack. Observed on Kubuntu 26.04 (PipeWire 1.6.2): the AppImage held /dev/snd/pcmC2D0p in mmap mode for ~20 h, while pipewire logged *spa.alsa front:2: playback open failed: Device or resource busy* every 5 s (~1400 h keeping the default sink unavailable).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem (Linux)
The audio-feedback path opens a cpal output stream and waits with
sink.sleep_until_end(). On ALSA, when the output device wedges (stale/hung open handle), that call can park the thread forever while the stream keeps holding/dev/snd/pcmC2D0p(mmap mode). Consequences on a PipeWire system:pipewirelogsspa.alsa front:2: playback open failed: Device or resource busyevery ~5 s (thousands of entries),Observed live on Kubuntu 26.04 (PipeWire 1.6.2, GNOME/KDE Wayland): the AppImage process held
/dev/snd/pcmC2D0pin mmap mode for ~20 h while the loop above repeated.Fix
Poll for completion with a 30 s hard cap instead of an indefinite
sleep_until_end(). On cap, log a warning and drop the sink/output stream — the ALSA handle is released, so the rest of the audio stack recovers even if the device itself is wedged.Verification
cargo checkpasses (rustc 1.98.1, tauri 2.11.5 deps; only 2 pre-existinghandylib warnings)fuser /dev/snd/pcmC2D0pempty after force-killing the wedge)Notes
front:CARD=...into PipeWire via/etc/asound.conf) currently masks the issue on this machine, but the root cause — an unbounded feedback wait occupying the output stream — stands.Happy to adjust the cap (e.g. make it settings-based) if the maintainers prefer another constant.