Very high CPU usage
I recently was wondering why the CPU usage on my Linux laptop was so high despite nothing much running, and discovered that rescrobbled was eating a full core.
I had Elisa open but not playing anything, and Vivaldi (a Chromium-based browser) with a video playing. The log just says:
Mar 13 22:14:02 linux1 rescrobbled[1590822]: Player Elisa stopped, looking for a new MPRIS player...
but nothing after that, which would be when I played the video and was noticing the high CPU usage.
Rescrobbled is 0.7.1.r8.g1db952f-1, Linux is Arch 6.13.4-arch1-1.
Thanks for the report, not sure why this is happening 😕
Are you using the whitelist config option? Metadata reported by browsers is generally pretty bad anyway, so maybe whitelisting only the players you're interested in would help filter out Chromium, to see if that's the cause of the issue.
(The way rescrobbled looks for players is in an idle loop, unsuspending its thread every second to look for players and then sleep again (src). So it should basically do nothing for 99% of the time.)
Yeah I have only elisa on the whitelist, and a lastfm key and listenbrainz token.
When elisa starts playing rescrobbled jumps up to 5% and then remains at like 2% CPU used, which already seems pretty high? It stays that high for the entire duration of the playback. When I pause it goes back to 0%, at least when I observe it now under htop. I wouldn't be surprised if it at some point can get into a bad state somehow.
Still, why is it that high during the playback? Is it consuming the audio stream or something? I would have expected it to just send out a scrobble record and then go back to the idle loop.
... and now it did do so when playing back some other track. What in the world?
It seems like specific tracks / albums cause constant cpu use, while others do not, which is already very strange.
The tracks that cause high CPU usage that I've noticed are from the Horizon Forbidden West soundtrack. Is there something I could provide you with or some debugging I could do to try and zero in on this?
Okey, caught it again being stuck at 35% CPU use for no reason. I attached strace and made a flamegraph real quick, it seems it's something in libdbus, unless the trace is wrong of course.
Here's another graph with debug compiled. Hope this helps.
Very strange isssue, thanks for putting in the effort in figuring out the root cause. I'll try and take a closer look later this weekend.
I just had the exact same issue happen, I am on v0.7.2, arch 6.14.4-1-cachyos. If I can help somehow, I'll be more than willing to
I seem to be having the same problem, I am on 0.8.0 (AUR rescrobbled-git package) on Arch 6.16.7-zen1-1-zen. On top of it taking a solid amount of cpu, rescrobbled also takes ~200MB of memory, and causes my dbus-broker to take over 900MB. Also, it is causing other applications to crash due to a MaxListenersExceededWarning error.
This is rather annoying since I use rescrobbled to sync my listens to lastfm from ncspot, as the normal Spotify client uses too much memory for my liking, but this just ends up using even more, and even causing crashes!
If I do dbus-monitor --system, I get constantly spammed with the following thousands of times per second:
signal time=1757911021.289552 sender=org.freedesktop.DBus -> destination=(null destination) serial=4294967295 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=NameOwnerChanged
string ":1.537109"
string ":1.537109"
string ""