mirror of
https://github.com/librespot-org/librespot.git
synced 2026-04-27 08:15:50 +03:00
[GH-ISSUE #765] Playing from artist often causes a crash #408
Labels
No labels
A-Alsa
SpotifyAPI
Tokio 1.0
audio
bug
can't reproduce
compilation
dependencies
duplicate
enhancement
good first issue
help wanted
high priority
imported
imported
invalid
new api
pull-request
question
reverse engineering
wiki
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/librespot#408
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @kraxarn on GitHub (May 27, 2021).
Original GitHub issue: https://github.com/librespot-org/librespot/issues/765
Originally assigned to: @Johannesd3 on GitHub.
I'm trying to play music from an artist, for example by doing a call to the Web API using
me/player/playwithspotify:artist:70BYFdaZbEKbeauJ670ysI, although, any artist seem to cause issues. A couple of tracks usually play fine, but after a short while, librespot seems to crash pretty consistently with a similar error message each time:Only happens when playing from any artist, anything else seems to work just fine. Playing from artist works poorly in general, as it only seems to play a few tracks, maybe related?
stack_backtrace.log
@Johannesd3 commented on GitHub (May 27, 2021):
Maybe you'd like to try out my proposed fix
@kraxarn commented on GitHub (May 27, 2021):
Thanks for the fast response, but I'm still experiencing issues. Got this error now instead:
@Johannesd3 commented on GitHub (May 27, 2021):
I'm sorry if it wasn't clear, but you should test https://github.com/Johannesd3/librespot/tree/fix-integer-overflow
You're experiencing another error probably because you turned release mode on, which disables integer overflow checks.
@kraxarn commented on GitHub (May 27, 2021):
Oh yeah, oops. I checked out your fork, but failed to notice it still checked out the dev branch 😅
Seems to work fine, but I still have the issue of it only playing a few tracks from the artist, but maybe that's a separate issue.
@Johannesd3 commented on GitHub (May 27, 2021):
Try to run it with
RUST_LOG=DEBUGenvironment variable and look out forMalformed or no gid, attempting to parse URI <...>. I'm curious what these angle brackets contain.@Johannesd3 commented on GitHub (May 27, 2021):
According to your stack trace, this message must appear every time shortly before crashes (would have crashed previously). Try the same on
dev, and if it crashes without showing this message, I'll have to investigate further.@kraxarn commented on GitHub (May 27, 2021):
Sorry for being unclear, it doesn't crash anymore, or at least haven't yet. The issue now is that it doesn't play all tracks from an artist. While running with
RUST_LOG=DEBUG, I found this in the log:so it thinks there are only 24 tracks, and after they are done playing, it just stops the playback. 2 of them are even duplicates, so there are really only 22 tracks.
@Johannesd3 commented on GitHub (May 27, 2021):
Yes, I know that it doesn't crash anymore. But the functions that calls the function that used to crash prints this debug message. If it doesn't appear, the function isn't called anymore, probably. But I touched only the crashing function itself, in particular it should be called exactly as many times as before. Would you please verify that the unfixed version still crashes, and whether this log message is shown before the crash?
@kraxarn commented on GitHub (May 27, 2021):
Seems like these issues are related. First thing I noticed was
which means the unfixed version finds 63 tracks, but also, it crashed after the 24th track with
so it seems like there's a paging issue and the "fixed" version only includes the first page.
@Johannesd3 commented on GitHub (May 27, 2021):
I can't imagine this little fix changed the behaviour. Is it possible that it depends on some other factor?
@kraxarn commented on GitHub (May 27, 2021):
Weird, you're right. Just tried it again and the fixed version found 63 tracks now, how odd. When it gets to the 25th track, instead of crashing, it just skips everything:
After that, it repeats from the beginning again. Not sure what I did differently.
@Johannesd3 commented on GitHub (May 27, 2021):
I'm no expert here. Maybe @ashthespy knows more.
@ashthespy commented on GitHub (May 28, 2021):
Just dumped the frame --
librespotis being quite robust here!is a bit of stretch, when you look at the actual
frame:Will have to investigate what the official client does to fetch more of the "popular" tracks after the initial few in the
frame.@ashthespy commented on GitHub (May 28, 2021):
Looks like we need to query some other endpoint for the rest of the tracks in the
frame- from a quick look, it might be/tracks/contains?ids=xx-- with


librespot-- with desktop client
@roderickvd commented on GitHub (Oct 5, 2021):
@ashthespy I'm not so experienced with doing MITM on Spotify, but if you could point me into the right direction what the
xxin/tracks/contains?ids=xxmight be then I shouldn't have too much trouble implementing that.For the record I can still reproduce this with this artist radio: https://open.spotify.com/artist/70BYFdaZbEKbeauJ670ysI?si=oZOKG3aUSAOWv2qOjvVLPw&dl_branch=1
@ashthespy commented on GitHub (Oct 5, 2021):
@roderickvd I'm not near my dev machine for a few days, and my memory isn't what it used to be :|
will get back to you soon!
Edit: IIRC
idis just thebase64part of the uri. eg7Fg4jpwpkdkGCvq1rrXnvxforspotify:track:7Fg4jpwpkdkGCvq1rrXnvx@roderickvd commented on GitHub (Oct 5, 2021):
Sure but an URI like
spotify:meta:page:2puzzles me because it misses the context?@ashthespy commented on GitHub (Oct 5, 2021):
Well, that is because we don't handle any pagination -- so ideally you would fetch the rest of tracks from the updated context/or this other endpoint, excluding the current ids.
To be very honest, I am on thin ice here, I haven't looked at things in a long long while...
@roderickvd commented on GitHub (Oct 6, 2021):
@sashahilton00 was talking about pagination on Gitter too. I'm just trying to grasp how I should implement that. In the current context state I see elements like
rowandindex, is that something I can use to move the list forward? Or when using/tracks/contains?ids=xxthen concretely which ids would I specify with the example frame in https://github.com/librespot-org/librespot/issues/765#issuecomment-850439438?Sorry if I seem pedantic 😄 just trying to get the hang of this.
@ashthespy commented on GitHub (Oct 7, 2021):
It's been a while, so I might be wrong here add a pinch of healthy scepticism ;-)
playing_from_fallback: true-- that gives us the first clue, since we are on the old API, server sends a Frame with only a few "fallback" tracks.But it looks like the desktop client does something different -- after the first 24 tracks, it adds more tracks by the same artist This is different than our current flow, which essentially boils down to
hm:autoplay-enabledthat yieldsspotify:station:artist:70BYFdaZbEKbeauJ670ysI. This would then populate a station (dynamic playlist) with multiple artists.I fear this might be something that needs the new API and digging into @devgianlu's reverse engineering..