alsa mixer polling ends in infinite loop when underlying device within pipewire disappears
If you are filing this issue with a regular release please try master as it might already be fixed. Note: Have not tested but given that's it's only been a few days since 0.3.36 is out - unlikely. But will retest on request...
Version, Distribution, Desktop Environment: 0.3.36, Gentoo, Sway
Description of Problem: More background here: https://codeberg.org/dnkl/yambar/issues/86 Note that there was an actual bug within yambar, however with the fixes there the behaviour is different in pulseaudio & pipewire.
Basically - the code opens device/mixer and polls for changes through alsa. When this alsa device is backed by pulseaudio there's no issues. However when pipewire is being used behind the scenes - on device removal (such as bluetooth dongle or usb card disconnect) the code ends in infinite loop because it keeps receiving POLLIN from pipewire (presumably?).
I managed to extract a small ugly code but it could serve as a reproducer perhaps.
The crux of the problem is - I would not expect POLLIN to keep coming from the pipewire device when there's no actual device behind it. Pulseaudio correctly handles "failover" (including continuing event dispatch on new events after new card is plugged in etc)
How Reproducible: Always - attaching a small reproducer.
Steps to Reproduce:
gcc alsa_test.c -lasound
- Play with volume settings etc and watch events being dispatched
- Disable the current card using pavucontrol or similar tool
Nothing happens in the
a.out ends in infinite loop where it keeps receiving events
Additional Info Eg.
pw-dump -N > file (As Attachment Please):