mirror of
https://github.com/librespot-org/librespot.git
synced 2026-04-27 00:05:55 +03:00
[GH-ISSUE #247] Timeout? Librespot-enabled device disappears from Spotify device list after a while #167
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#167
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 @codethief on GitHub (Sep 10, 2018).
Original GitHub issue: https://github.com/librespot-org/librespot/issues/247
My RaspberryPi with Librespot has been running for a couple hours now and, earlier today, everything was working fine and I could listen to songs on Spotify through the speakers connected to the RPi. At some point this afternoon I paused the music, though, and now, hours later, I wanted to unpause it. However, Spotify didn't list my RPi among the available devices anymore.
So I ssh'd into the RPi and took a look at the logs. They seemed fine:
I then restarted librespot through
service librestart stop/startand this fixed the issue—the RPi reappeared in Spotify's device list. Meanwhile, the logs are:So it seems that there is some kind of timeout causing Spotify to forget about a device with Librespot after a while?
@cortegedusage commented on GitHub (Sep 11, 2018):
I have seen this behaviour too. Most of the time Restarting the app on my
phone restores the connection.
Op di 11 sep. 2018 01:19 schreef codethief notifications@github.com:
@codethief commented on GitHub (Sep 11, 2018):
@cortegedusage I tried that, too (both on my phone and my laptop), but unfortunately it didn't do the trick.
@Shuro commented on GitHub (Oct 3, 2018):
I have the same behaviour, just with Moodeaudio for Raspberry Pi. I can't provide any logs sadly.
At some Point, the music stops and when I check Spotify on PC or on my Smartphone, there is no available device. I have to open Moode in browser and select to restart librespot to make it available again.
@codethief commented on GitHub (Oct 4, 2018):
This is not the behavior I'm seeing. Music playback works flawlessly. It's only when librespot has been idling for hours that the device will disappear from the Spotify app.
@dangerfish96 commented on GitHub (Oct 4, 2018):
I am experiencing the same problem.
I am also using a RaspberryPi (raspotify).
@mherger commented on GitHub (Oct 6, 2018):
As I’ve had similar reports for my Spotty implementation (based on librespot), I am currently investigating a few ideas. Could it be that your internet connection goes down every now and then? Some ISPs do this regularly, like every night. I have a feeling that librespot doesn’t like that.
@michaelherger commented on GitHub (Oct 6, 2018):
Just to confirm my theory (don't know why my previous comment was posted by my other account...): I run librespot/spotty in a VM. It showed up on Spotify. Then I cut the VM's network connection for a few seconds. Moments later the device disappeared from Spotify.
Unfortunately spotty/librespot didn't log anything when this happened, not even in verbose mode. It just sat there doing nothing.
@kingosticks commented on GitHub (Oct 6, 2018):
Losing Internet connection is different to losing the entire network
connection. Can you narrow it down?
On Sat, 6 Oct 2018, 16:56 michaelherger, notifications@github.com wrote:
@michaelherger commented on GitHub (Oct 6, 2018):
Didn't make any difference.
@kingosticks commented on GitHub (Oct 7, 2018):
librespot's verbose mode sets mdns logging to
infolevel (the same as in the normal logging). You can force your own logging config with something like:When I do that and I take away the network connection I see
And when I restore the connection it goes back to normal, no issues.
@michalfita commented on GitHub (Oct 15, 2018):
Isn't it a long standing problem, of the connection lost that doesn't stop librespot, hence it cannot be restarted by systemd? I face the same symptoms few times a day.
@sashahilton00 commented on GitHub (Nov 3, 2018):
I've noticed this too, but not just restricted to librespot, I see similar behaviour from my Mu-So, and occasionally my phone.. I have a feeling spotify changed something behind the scenes, which inadvertently makes things more patchy. Relaunching app fixes the problem for me though, on both phone and desktop. It would be good if we could work out what causes this, though given it's unclear what steps one must take to reproduce it, I suspect that could be difficult.
@dnr commented on GitHub (Nov 14, 2018):
I usually have to restart librespot a few times a day if I'm listening for a while also.
Spotify Connect is overall really buggy in my experience. I have lots of problems with queue syncing when switching among the linux desktop app, mac desktop app, android, and web players.
However, the other ones don't seem to disappear from the devices list like librespot does, they just sometimes get out of sync with other active apps. It would be great if librespot could detect when it's gotten into this situation and reconnect.
@StopMotionCuber commented on GitHub (Nov 14, 2018):
I also used to have some problems with librespot (as having to restart it often), but recently it is working quite stable.
I guess the thing that changed for me was that I disabled the firewall in my router (probably this was blocking some packages when reconnecting to the Pi)
@codethief commented on GitHub (Nov 15, 2018):
For what it's worth, I've forgotten to turn off my Raspberry PI with librespot before going to bed a couple times now, so it was running the entire night. In the morning, when I tried to play a song through Spotify, it was still working perfectly, so it seems the issue is very hard to reproduce.
@sashahilton00 commented on GitHub (Nov 15, 2018):
My gut feeling is that this is a combination of Connect being buggy, and also is not handling reconnections. I suspect if/when we get around to implementing reconnection logic, the frequency of this bug should significantly decrease, and any remaining occurrences will likely be chalked up to server side errors
@dangerfish96 commented on GitHub (Nov 22, 2018):
This problem does not happen anymore for me since one of last commits
@capt-marc commented on GitHub (Jan 15, 2019):
Still have this issue (running on latest build)- It happens randomly - sometimes librespot runs for ages - sometimes a few times a week. Tonight it happened on both my Pi's - connected on 2 different locations and networks. (same city thou)
It must be something with the handshake with the server that fails. If the connection between librespot and the Spotify server is unavailable at that exact time it fails and panic.
@codethief commented on GitHub (Jan 19, 2019):
Update on my earlier comment: I've now had my Pi running for 4-5 days. The first few days it was working perfectly but this morning the device suddenly wasn't showing up among the "Other devices" in the Spotify app anymore. So I'm with @capt-marc here, the issue is neither fixed nor is it occurring deterministically.
@aykevl commented on GitHub (Mar 20, 2019):
I have the same issue when using spotifyd. When I pause music, it will disappear after a while (closing and re-opening the Android app doesn't help). When I hit Ctrl+C, I get an error message "Connection reset by peer" but somehow it doesn't quit. When I hit Ctrl+C again, it quits. This is the output (see
^Cfor Ctrl+C):Note that the connection here is rather flaky and sometimes disappears for a while (I don't have a choice of ISP...). However, it seems that, when doing a Ctrl+C, something detects that the connection is broken. It would be very useful to reconnect in this case.
If someone knows how to debug this further to see where the error comes from, I'm happy to help.
Also see #276 which might be related.
@michalfita commented on GitHub (Mar 20, 2019):
I don't know the code. But that's interesting observation from my C background experience. For me it smells some stale
select()not returning on error, but awaken by SIGINT (coming from Ctrl+C sent to terminal).@dougestey commented on GitHub (Mar 22, 2019):
This happens for me with every project I've used based on this library (volumio, raspotify, etc.) Even if librespot can't handle reconnections yet, if we could at least have it crash it would be easier to programmatically restart it.
@tofalck commented on GitHub (Feb 12, 2021):
I see this issue intermittently.
My RPI is placed in a closet very close to my main wifi access point, but I think the issue is wifi connection loss due to the rather bad wifi onboard the RPI.
It's been stable outside its casing for the past 24 hours and I normally see the issue well within that timespan.
I can confirm the issue exists on at least Moode, Ropieee and Volumio. Ropieee seems a little more stable than the other two.
A workaround could perhaps be a kind of networkd-dispatcher monitoring script to restart librespot when either network connection resumes from a previous connection loss and librespot was running before the script was dispatched.
This should somehow be baked in or installed by the librespot library to make it as friction free as possible.
@ashthespy commented on GitHub (Feb 12, 2021):
Maybe we could check connectivity by using
AsterNovi-belgii-flower-1mb.jpg?https://phabricator.wikimedia.org/T273741 😁
@codethief commented on GitHub (Feb 15, 2021):
Update to my previous comments: I recently switched from PiMusicBox to HiFiBerryOS (using the same Raspberry Pi) and things have been running perfectly ever since – the RaspberryPi shows up in Spotify's device list every single time! Not sure what the people at HiFiBerry are doing differently (apart from using (a custom build of) spotifyd whereas PiMusicBox uses raspotify(?)) but, in any case, it works! :)
@kingosticks commented on GitHub (Feb 15, 2021):
The difference is PiMusicbox uses a very old build of librespot, probably still the same one it had back in 2018. I'm not sure HifiBerryOS even existed back in 2018!
@codethief commented on GitHub (Feb 18, 2021):
I'm pretty sure it didn't. :)
True, but I'm not convinced yet this is what made the crucial difference. Because why are people still experiencing this issue with (I assume) recent builds? It's either because there is still a bug in librespot or, as I was hinting at in my previous comment, maybe it's not librespot itself that is at fault but rather the librespot wrapper (in this case raspotify)?
@kingosticks commented on GitHub (Feb 18, 2021):
To be clear, Pimusicbox does not use raspotify. It uses librespot as is. Sorry, I should have been explicit.
@codethief commented on GitHub (Feb 18, 2021):
Oh well, then I take everything back. :)
@roderickvd commented on GitHub (May 25, 2021):
Tracked by #609.