Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cosmic-applet-audio 100% CPU usage when pulseaudio is not installed #788

Open
nic-obert opened this issue Jan 25, 2025 · 1 comment
Open

Comments

@nic-obert
Copy link

When running cosmic-applet-audio without pulseaudio available on the system, the cosmic-applet-audio process spikes to 100% CPU usage and continuously prints the following error message onto the console:

2025-01-25T17:40:52.169316Z ERROR cosmic_applet_audio::pulse: Failed to connect to server: PAErr(PAErr(-1))

The error message and the high CPU usage are solved by making pulseaudio available, for example by installing it.

My guess is that cosmic-applet-audio gets stuck in an infinite loop without sleeps whenever it can't connect to the pulseaudio server.
Also, since the pulseaudio package is required to run cosmic-applet-audio, it would make sense to include it in the dependencies.
Running pacman -Qi cosmic-applets returns

Name            : cosmic-applets
Version         : 1.0.0.alpha.5.1-1
Description     : Applets for COSMIC Panel
Architecture    : x86_64
URL             : https://github.com/pop-os/cosmic-applets
Licenses        : GPL-3.0-only
Groups          : cosmic
Provides        : None
Depends On      : cosmic-icon-theme  dbus  gcc-libs  glibc  libinput
                  libpulse  libxkbcommon  systemd-libs
Optional Deps   : None
Required By     : cosmic-session
Optional For    : None
Conflicts With  : None
Replaces        : None
Installed Size  : 90,10 MiB
Packager        : Peter Jung <[email protected]>
Build Date      : mer 15 gen 2025, 17:56:57
Install Date    : sab 25 gen 2025, 18:10:30
Install Reason  : Explicitly installed
Install Script  : No
Validated By    : Signature

Looking at the dependencies, libpulse is required but not pulseaudio. Since pulseaudio already requires libpulse, it would make sense for cosmic-applets to directly require pulseaudio instead.

My system:
Arch Linux (kernel 6.12.10.arch1-1)
cosmic-applets 1.0.0.alpha.5.1-1

@nic-obert
Copy link
Author

I think I found the culprit for the 100% CPU usage problem, but I haven't tested it.
This is the loop
In cosmic-applet-audio/src/pulse.rs:

loop {
  state = start_listening(state, &mut output).await;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant