Constant CPU usage #1500
Replies: 1 comment 10 replies
-
Interesting investigation. We have one main loop that handles the whole spotify connect logic and also the player. But that loop blocks until it receives a command. So that shouldn't be the issue you see. You can find the loop in Anyhow I think I noticed something similar and it is the result of how we handle the player/mixer. The spirc (the spotify connect logic handling) takes our player and then uses it as needed. That itself isn't really the problem, but the player has always an active audio source/mixer. So even if we don't play anything there will be an instance of an audio mixer/sink/source for librespot. So I think what you see might be the result of two different causes. The initial cause is, that we always have an active audio source/sink/mixer to the underlying audio backend. But the actual high idle usage might be the open connection to the audio backend, but that's more speculation than knowledge. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
If librespot is idle, it still causes a “typical of modern ****** busylooping apps” constant 1-5% CPU usage across the chain: all of
librespot
,pipewire
, andpipewire-pulse
processes are taking a few percent. Yes, it's not much for each of them, but they sum up, and apps shouldn't busyloop—it's as if they were all Electron apps, notorious for busylooping.I've tried monitoring the processes with
strace
, and what I can observe is thatpipewire-pulse
process is repeatedly epolling at high speed.pipewire-pulse
diminishes (but it's still too much—it should just wait). There shouldn't be any other processes connected.pw-top
gives similar results: it shows constant ALSA driver activity when librespot is running, but that disappears when librespot is not runningIt's as if librespot would be constantly playing something.
However, if I attach
strace
to thelibrespot
orpipewire
processes, they are nicelyepolling
with semi-reasonable timeouts; no repetition withpipewire
itself, and neither cause any of the hyperactivity ofpipewire-pulse
. So I'm not sure if this is a librespot bug, or the crappiness of pulseaudio/pipewire-pulse? It's constantly polling at hyperactive speeds when it has any connections to it, even if they're inactive?But then again, according to
htop
, both thelibrespot
andpipewire
processes take respective ~3% and ~0.7% CPU, so pipewire must be doing something that it shouldn't be doing.Any ideas?
strace pipewire-pulse
(with librespot running, not playing anything)This rolls at high hyperactive speeds even with nothing playing:
strace librespot
This took several seconds to obtain, meanwhile the CPU usage is about 3%:
pw-top
(with librespot running, not playing anything):pw-top
(without librespot running):Beta Was this translation helpful? Give feedback.
All reactions