fix(pulse): use blocking iterate to prevent busy-spin on boot#1919
Closed
markc wants to merge 1 commit into
Closed
fix(pulse): use blocking iterate to prevent busy-spin on boot#1919markc wants to merge 1 commit into
markc wants to merge 1 commit into
Conversation
When pipewire-pulse is not yet ready at boot, pa_mainloop_iterate(false) returns immediately, causing a tight 100% CPU loop. This cascades into cosmic-osd spinning and Firefox/Thunderbird becoming unresponsive. Switch to iterate(true) (blocking) so the loop sleeps until there is an event to process. Also handle Failed/Terminated context states explicitly instead of looping forever. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Member
|
This crate will be dropped when pop-os/cosmic-settings-daemon#135 is merged. |
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.
Summary
pa_mainloop_iterate(false)(non-blocking) in the PulseAudio connection loop causes a 100% CPU busy-spin whenpipewire-pulseis not yet ready at bootiterate(true)(blocking) so the loop sleeps until there is an event to processFailed/Terminatedcontext states instead of looping foreverProblem
On systems where PipeWire starts concurrently with COSMIC,
pipewire-pulsemay not be ready whencosmic-settings-daemonconnects. The non-blockingiterate(false)call returns immediately, creating a tight loop that:cosmic-osdspinning (retrying volume/device notifications)Fix
Two changes to
subscriptions/pulse/src/lib.rs:iterate(false)→iterate(true)— blocks until there is a PulseAudio event, eliminating the busy-spinFailed/Terminatedstates — the previous code only checked forReady, so a failed connection would loop forever silently. Now it logs an error and exits the thread cleanly.Testing
Tested on CachyOS (COSMIC desktop from packages) with PipeWire: