pipewire/spa/plugins/alsa
Mike Lothian b904c3ee15 spa: alsa: acp-device: stop 100% CPU spin when a poll fd hangs up
handle_acp_poll() copies the poll revents into ACP and clears them, but
never actually looks at them. When one of the polled fds reports
POLLERR/POLLHUP - which happens when the ALSA card goes away, e.g. the
audio function of a USB dock being unplugged - the source is never
removed, and because that condition is level-triggered the loop just
keeps redispatching the handler.

The result is wireplumber pegged at 100% CPU, spinning on the card's
control fd:

    read(24, ..., 72) = -1 ENODEV (No such device)

with fd 24 pointing at a now-deleted /dev/snd/controlC<n>. It stays like
that until the card comes back or the service is restarted.

Accumulate the returned mask and, if anything reports SPA_IO_ERR or
SPA_IO_HUP, drop the poll sources so we stop hammering a dead descriptor.
The udev monitor still drives the real device removal and setup_sources()
re-arms the poll if the card reappears - the same teardown alsa-pcm.c
already does for its own control sources.

Signed-off-by: Mike Lothian <mike@fireburn.co.uk>
2026-07-05 00:04:50 +01:00
..
acp Use descriptive description for Pro devices 2026-07-01 09:00:39 +00:00
mixer acp: partially revert f76327e076 2026-04-28 12:01:06 +02:00
90-pipewire-alsa.rules alsa-card-profiles: Add config for a couple of JBL gaming headsets 2026-01-22 15:35:05 +00:00
acp-tool.c spa/plugins: include <stdlib.h> for alloca() on non-linux 2026-03-12 09:21:40 +00:00
alsa-acp-device.c spa: alsa: acp-device: stop 100% CPU spin when a poll fd hangs up 2026-07-05 00:04:50 +01:00
alsa-compress-offload-device.c spa: alsa: avoid potential uninitialized variable use 2024-09-18 19:54:13 +00:00
alsa-compress-offload-sink.c treewide: replace EBADFD with posix EBADF 2026-05-27 13:36:39 +02:00
alsa-pcm-device.c spa: alsa: avoid potential uninitialized variable use 2024-09-18 19:54:13 +00:00
alsa-pcm-sink.c spa: acp: get and emit UCM information for SplitPCM devices 2024-12-21 16:03:19 +02:00
alsa-pcm-source.c spa: acp: get and emit UCM information for SplitPCM devices 2024-12-21 16:03:19 +02:00
alsa-pcm.c alsa: avoid rounding down period_size 2026-06-04 16:54:37 +02:00
alsa-pcm.h spa: alsa: actually set the channel map when use-chmap=true 2026-01-05 15:37:05 +00:00
alsa-seq-bridge.c alsa-seq: add : between client and port name 2026-04-15 11:20:18 +02:00
alsa-seq.c midi: don't write trailing continuation 0xf0 for SysEx 2026-06-01 13:08:11 +02:00
alsa-seq.h alsa-seq: handle SysEx without snd_midi_event_t 2026-05-21 12:45:43 +02:00
alsa-udev.c security: bound alloca size for udev property strings 2026-04-29 14:22:33 +02:00
alsa.c meson: fix build with missing libudev-devel 2024-02-06 11:49:40 +01:00
alsa.h spa: remove unnecessary indirection for some spa_log_topics 2023-10-06 13:08:24 +00:00
compress-offload-api-util.c alsa-compress-offload: Add device object and udev based autodetection 2023-09-02 08:28:22 +00:00
compress-offload-api-util.h alsa-compress-offload: Add device object and udev based autodetection 2023-09-02 08:28:22 +00:00
compress-offload-api.c compress-offload: fix fragment count validation in set_params 2026-06-16 09:38:19 +00:00
compress-offload-api.h alsa-compress-offload: Add device object and udev based autodetection 2023-09-02 08:28:22 +00:00
meson.build meson: fix build with missing libudev-devel 2024-02-06 11:49:40 +01:00
test-hw-params.c treewide: use SPDX tags to specify copyright information 2023-02-16 10:54:48 +00:00
test-timer.c fix compilation some more 2024-06-18 15:41:12 +02:00