https://bugs.kde.org/show_bug.cgi?id=511472
Kolei Chen <[email protected]> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |[email protected] --- Comment #10 from Kolei Chen <[email protected]> --- Hit this again today (it recurs every few weeks for me). This time I looked at the PipeWire side while it was stuck. I think the hang is a permanent deadlock between plasmashell, PipeWire and WirePlumber, not just a slow audio backend. That would also explain why it never recovers by itself. Versions: plasma-workspace 6.8.2, kpipewire 6.8.2, KF 6.31.0, Qt 6.12.0, PipeWire 1.6.11, WirePlumber 0.5.19, libcanberra 0.30, Arch Linux, Wayland. plasmashell main thread (same as the original report): pw_thread_loop_wait -> snd_pcm_pipewire_prepare (pcm_pipewire.c:585, waits for pw->negotiated, no timeout) -> snd_pcm_prepare -> snd_pcm_hw_params -> open_alsa -> alsa_driver_play -> ca_context_play_full -> multi_driver_play -> ca_context_play_full -> NotificationManager::Notifications::playSoundHint Before that, the pulse driver had already timed out (pipewire-pulse: "[libcanberra] timeout on stream"). libcanberra then fell back to ALSA, and that path never returns. What I found on the PipeWire side: 1. The pipewire daemon had **stopped reading from WirePlumber's socket**. In the pipewire process's epoll fdinfo, WirePlumber's connection (pipewire-0-manager) had `events: 18`, i.e. EPOLLIN removed. `ss -xp` showed ~171 KB of unread data from WirePlumber queued in pipewire's Recv-Q. That is the `pw_impl_client` "busy" state. 2. In `src/pipewire/impl-node.c`, `node_set_param()` marks the *calling* client busy when the target node returns an async result. The client stays busy until the node's owner answers the sync. 3. The node involved belongs to plasmashell itself: the KPipeWire video stream nodes (`Stream/Input/Video`, the task manager thumbnails). Their PipeWire connection is serviced from the Qt main thread. pipewire had ~55 KB queued towards that plasmashell connection that was never read. One of those nodes was created just before the stuck ALSA stream (object.serial 10209 vs 10213). So the cycle is: - plasmashell's GUI thread blocks in libcanberra, waiting for its new ALSA/pulse stream to be negotiated. - WirePlumber had called set_param on plasmashell's KPipeWire node, so pipewire marked WirePlumber busy until plasmashell answers. plasmashell can't answer, because its GUI thread is blocked. - A busy WirePlumber links nothing new, so the canberra stream is never negotiated, and the cycle closes. Side effects match comment 7: every new stream system-wide stalls (Firefox had no audio). `wpctl status`, `pw-dump` and `pw-cli enum-params` hang because their bind/sync goes through the same stall. Streams that were already linked keep playing. Notably, **restarting WirePlumber does not help**. The new WirePlumber immediately calls set_param on the existing plasmashell nodes at startup and goes busy again (`events: 18` on its new fd). Only killing plasmashell breaks the cycle. It ignores SIGTERM, so it needs SIGKILL. After that, audio and wpctl recovered immediately. This supports moving playback off the GUI thread (MR !6516 / !7266). It also suggests that any app that serves a PipeWire node from its GUI thread and also plays a canberra sound synchronously can wedge the whole session manager. A timeout in pipewire-alsa's prepare and/or in the server-side "busy" wait would be worth raising with PipeWire. I can open an issue there if that's useful. (with help from LLMs to trace the source files for me) -- You are receiving this mail because: You are watching all bug changes.
