mirror of
https://github.com/librespot-org/librespot.git
synced 2026-04-27 08:15:50 +03:00
[GH-ISSUE #289] Crash upon connect #195
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#195
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 @patrickjane on GitHub (Feb 20, 2019).
Original GitHub issue: https://github.com/librespot-org/librespot/issues/289
I have just compiled librespot on my raspberry pi 3 (raspbian stretch), and librespot crashed after some of my connect attempts. The first 2 attempts succeeded and I was able to play music, however then when starting librespot and connecting on my iPhone librespot crashed:
Also, even when playback succeeded, I saw a lot of those warnings:
@sashahilton00 commented on GitHub (Mar 11, 2019):
this is likely a bad implementation of zeroconf/multicast on your router, potentially dropped/bad packets.
@patrickjane commented on GitHub (Mar 11, 2019):
You mean a firewall issue? I am using pfsense, how would I make it not "drop bad packets"?
@sashahilton00 commented on GitHub (Mar 11, 2019):
it might be a firewall issue, but I would guess it's more likely an underlying issue with the actual multicast implementation on your router. We've seen it happen once or twice before https://github.com/librespot-org/librespot/issues/278#issuecomment-444884325, though it's hard to say for certain as all one can see in the crash logs is that the assertion in the authentication handler failed. You could try disabling the firewall whilst testing and seeing if that helps, and if so, gradually turning parts back on to identify problematic area, but other than that, we're going to struggle ot be of much use here.
@patrickjane commented on GitHub (Mar 12, 2019):
What kind of issue would the multicast have? Could you provide some more details about the issue, so I could ask on pfsense Support Forums?
Would debugging the issue help?
@sashahilton00 commented on GitHub (Mar 12, 2019):
I can't say for sure, I know very little about how multicast works, I just know from previous issues here that some implementations are bad/not compliant, which can lead to librespot erroring on some networks. I suggest trying to log in to librespot manually, and if that works consistently, then you can say with a degree of certainty that an issue with multicast is likely the issue. If it fails with manual login, then that woul suggest a problem with the firewall or librespot.
@patrickjane commented on GitHub (Mar 13, 2019):
Okay so without any more infos I doubt I can go over to the pfsense guys and ask them whats wrong. Also, I doubt that there is any issue within the pfsense implementation, since its a really widely used and stable unix distribution.
I've just installed the spotify app on my TV, and using my phone via spotify connect on the TV, and I had none of those issues. Playback is fine, I can connect/reconnect as I want, switch tracks etc pp.
So I doubt again that its some issue with my router.
@kingosticks commented on GitHub (Mar 13, 2019):
And how did you specify the credentials for the Spotify app on your TV? If you specified them manually (the only option with the particular app on my aging TV, for example) then that's not the same as what you've configured librespot to do. Have you tried logging in manually (by explicitly setting your credentials using librespot's
--usernameand--passwordoptions?) as @sashahilton00 suggested? That would help narrow things down.@patrickjane commented on GitHub (Mar 13, 2019):
I haven't specified credentials. I started the app on my TV (LG55C8 with webOS 3.5) and just attached my phone. No credentials necessary.
I haven't yet tried with manual credentials in librespot, going to try later.
@patrickjane commented on GitHub (Mar 13, 2019):
Okay so indeed, when supplying credentials to
librespot, the issue does not happen.As additional info, since this isn't made very clear in my original post, and I just had to remember myself how to reproduce this:
I admit that this isn't a normal usecase, but most likely I stumbled across this as I had issues switching songs after connecting and playback started.
I am still having those song-switching issues, should I create a seprate issue for this, or is this a known issue?
@kingosticks commented on GitHub (Mar 13, 2019):
If you wait a bit (or restart Spotify on your device) before step 5 do you still get this problem? Perhaps your device is still using the public key from the original librespot instance (1.) rather than the new instance (4.) when it tries to calculate the new MAC?
@patrickjane commented on GitHub (Mar 13, 2019):
Okay I can confirm that waiting a bit between the re-connects will not result in a crash.
@kingosticks commented on GitHub (Mar 13, 2019):
Should be pretty simple to add some error messages and better handling (we don't need to panic, just abort the auth attempt) of this situation.
@kingosticks commented on GitHub (Mar 13, 2019):
Fancy trying out my fix, @patrickjane ?
@patrickjane commented on GitHub (Mar 13, 2019):
Sure. Gonna take a while for it to compile on my pi tho.
@ashthespy commented on GitHub (Mar 13, 2019):
Docker to the rescue! ;-)
@patrickjane commented on GitHub (Mar 13, 2019):
I hate docker :|
@kingosticks commented on GitHub (Mar 13, 2019):
Just keep in mind that my "fix" here is just not to crash! The client using the wrong key for a period of time (assuming I'm right) is not something librespot can do anything about. That's more of a client bug.
I guess librespot could store and then reuse it's keypair rather than regenerating it, but I'm not really into that idea.
@patrickjane commented on GitHub (Mar 13, 2019):
Its fine, really. Just not making it crash sounds like a good fix. This situation is not a normal usecase anway, in which case error instead of crash sounds viable.
@patrickjane commented on GitHub (Mar 13, 2019):
Okay so I have been trying this out for a while now, and I couldnt make it crash. However, I also didn't see any error message regarding this issue, ist just kept working.
To double check I tried with the old version, and it crashed again.
So either your fix did it, but doesnt give an error message, or anything else between my orignal version and yours might have fixed it.
I might add that in my original version I also had the issue that I am unable to switch playlists once playback started, and I had to reconnect my device to start a different song. I also dont have that issue with your version now, so I am double happy :)
@kingosticks commented on GitHub (Mar 13, 2019):
I made it a warning message rather than an error - there is an argument that libraries shouldn't output stuff by default - but librespot (the program, not the library) does by default display warning messages for this module so if the fix was triggered you should have seen the message. So yeh, sounds like my fix hasn't helped but rather something else in the latest code has. However, I can't see what that could be since the offending line is explicitly identified in the original stacktrace and the file hasn't otherwise changed in a long time. I am confused.
It sounds like your switching playlist issue was https://github.com/librespot-org/librespot/issues/288
@patrickjane commented on GitHub (Mar 14, 2019):
Okay, made some more tries, here it is:
👍