-
Notifications
You must be signed in to change notification settings - Fork 109
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sometimes it fails to switch tracks and Mopidy stops playing anything #389
Comments
I've not noticed this one, and I've logged many, many hours now. Is this suddenly in the middle of a playback or in response to anything in particular? What GST sink do you have ? |
It's after a track is done playing. I can't particularly tell you what specifically causes it, the majority of times things just play normally. I have the following configured for audio output:
So I'm playing the audio to a fifo file for Snapcast to pick it up. |
It just happened again, but this time more is logged.
|
It took about 2 weeks, but it happened again today. |
Interestingly it's not just that it stops playing something, the whole server stops responding entirely. Normally I use Iris to control it but refreshing the page at that point means it'll load until a time out happens. This time it took 16 hours of playing music (I forgot to turn it off at night 😅) before it happened and I had to restart it again (and thus lose my queue) to get it to work again. EDIT: it just happened again, only like 3 songs after restarting it from before. How is no one else experiencing this? |
Just wanted to pitch in to say I have experienced the same issue multiple (~8) times. Same setup with Iris as frontend and no response on Mopidy end and often comparable logging. Occurred two times last week. Only (anecdotical) pointer I have is that it quite seems to happen either directly or some time/tracks after a track skip within a Spotify playlist. Please let me know if there is anything I could do to assist a debugging this issue. |
Happens to me too - but not Spotify. Really reduces the SPAF when the media server just stops working for no apparent reason. Let me know if there is anything I can do to help debug. My audio output is:
|
So after finally getting credentials working again from #394, this instantly happened again, twice.
This is getting close to making Spotify unusable 😢 |
Presumably you're also using the latest release of gst-pluign-spotfy? That latest release is required going forwards but I expect we'll hit some bumps along the way. Feel free to tell Spotify what you think of their inability to communicate important changes or produce a public native SDK. |
0.13.0. I know 0.13.1 is out so I'll try again with that one soon, but honestly I don't expect much 😅 |
Is that one you've built yourself ? The new (custom) builds at https://github.com/kingosticks/gst-plugins-rs-build/releases/tag/gst-plugin-spotify_0.13.1-1 are based on the latest dev branch of librespot so it might perform differently. p.s. if this is for Snapcast, do you need the wavenc in there? |
It's from the Alpine repositories. To run this whole thing I'm using https://github.com/jaedb/Iris/blob/master/Dockerfile.alpine which installs py3-mopidy-spotify from the Alpine repositories which pulls in gst-plugins-rs. The output is piped into Snapcast yes. |
I see. You'll have to wait for gst-plugins-rs to update then. I wonder why they are pointlessly adding the wav encoder. |
We're experiencing the same behaviour. Before The new behaviour is not exact as before (still sometimes after a track), but now sometimes when track is 01:30 it stops playing... Can't find any usefull logs (even with full debug mode on). |
You should be able to collect Gstreamer logs by setting env variable |
Looks like something is blocked... |
I don't understand your failure description. Are you saying that playback works up to a certain point and then stops? The log above suggests it doesn't work at all. |
Yes
It works, but maybe this is a problem. I have a strict firewall, I've whitelisted 80,443 and 4070 https://apresolve.spotify.com/. |
I'm still pretty confused. The log shows spotifyaudiosrc cannot start. If it cannot start, it cannot be working. Or is this log showing it not working after some other track that did work (rather than the other case where it stops working up until a certain point in the track)? |
This is what my log shows when failing to switch tracks (so, after the previous track has concluded, which did work), similar to @svanrossem . Running jaedb/iris:latest from Docker Hub with the Oauth workaround (but happening with old user/pass auth as well) on an Unraid server. After manually changing to the next track, playback resumes (skipping the track that it failed to play). |
That log shows the same connection error. And it's also using the old (current release) version of librespot/gst-plugin-spotify. Is anyone able to replace the old gst-plugin-spotify in their image with the new custom one we recommend, and see if the issue is still present? I appreciate this issue is very annoying but I'm focused on helping trying to get the new version of librespot released. This older version is on its last legs and we need to get everyone moved off it. And progress is being made, so hopefully won't be long. |
I’m running the latest version of ‘mopidy-spotify’ and ‘gst-spotify’ from your ‘0.13-dev’-branch. |
Sorry, yes, I forgot you said that. Can I assume your firewall changes had no impact? Hmm. I'm going to build another which ramps up the debug logging, I can't think why you'd see connection issues just from being in a container. |
As far as I know we only need TCP port 4070, 443 and 80. Some people say when port 4070 is blocked it will fallback to port 443, when moving to I'm running Mopidy in a container in Kubernetes. |
Got some logs after again having this issue.
I did some tests from the container
|
So, after changing the track (just hit next) the track starts playing, and when checking the first endpoint
|
I wonder if this is related to using ap-gew4.spotify.com. librespot 0.4 used to have loads of problems with that particular access point and there was a change made to avoid using it. That change didn't make it into 0.5, I am told that was intentional but there's no detail on why. Can you try hacking your /etc/hosts to disrupt that AP and therefore force librespot it to use another one? |
And what Spotify audio quality have you all got configured here? |
There are some new packages/binaries at https://github.com/kingosticks/gst-plugins-rs-build/actions/runs/10886698789 with more logging. Run |
No specific audio quality setting configured through mopidy-spotify config here, so assuming default bitrate of 160. Will block ap-gew4.spotify.com through /etc/hosts this evening and report back! |
Blocked through /etc/hosts as indicated by:
Still experienced 6 stops over 2 hours of playtime, but that seems due to the way the block is handled as the log indicates:
Anecdotically, it does not seem it now fails more often then without hosts block, which might indicate you are on the right track here. Will try and run the gst-plugin-spotify you built later (when I figure out where gstreamer loads it from) |
I've build gst-spotify based on your latest commit @kingosticks ; https://gitlab.freedesktop.org/kingosticks/gst-plugins-rs/-/commit/c0a3f70ca097cb3d5eb6b35ea3e2a87ed4dad964. When I block
How random is https://github.com/librespot-org/librespot/blob/338d8b90b295704c5d9945634b2548a6199f1af9/docs/connection.md#access-point-connection? The
As a workaround I've pointed
That's working fine. I'll report when I've got errors again... |
Again connection refused errors...
Is it possible to output which ap the plugin is using? |
Yes, it's in the logs if you use run with full librespot debuging using my branch:
But I'm not sure these domains always point to the same actual servers, it's likely based on load/location/whatever. For me:
|
I have exactly that value but don't get any AP information?
No I mean
and when I block |
It turns out librespot doesn't retry with the other APs unless a very specific type of error occurs. These connection refused problems don't qualify so it doesn't do any retries! I'm submitting a PR to fix this, should make things more robust. |
Are you sure you're building from latest https://gitlab.freedesktop.org/kingosticks/gst-plugins-rs/-/tree/0.13-librespot-dev for the extra logging? |
ARG GST_PLUGINS_RS_TAG=0.13-librespot-dev
RUN git clone -c advice.detachedHead=false \
--single-branch --depth 1 \
--branch ${GST_PLUGINS_RS_TAG} \
https://gitlab.freedesktop.org/kingosticks/gst-plugins-rs.git ./ \
&& git reset --hard c05da5be655a84ec98b6100a1fef6cf1ebec01d9 EDIT: just replaced it with your latest commit... |
That very latest commit pulls in the new connection retry mechanism in librespot. So it won't make a difference to logging, but it might help with our actual issue. Please do try it. Sorry to bang on about this, but for the logging, are you also definitely setting the |
With the latest version of bot
|
Urgh, right. There are too many evolving parts here, I've made a mess here and it's getting silly. Latest version of 0.13-librespot-dev (c05da5be655a84ec98b6100a1fef6cf1ebec01d9) implements access token login instead of user and password login. But to use that you need unreleased version of mopidy-spotify. But to use that you need latest Mopidy code, which you're (very reasonably) not using. I should have made a new branch for my access-token work, my bad. I'll fix 0.13-librespot-dev. You'll also need to make sure you're using Mopidy-Spotify==5.0.0a2. |
OK, so 0.13-librespot-dev at 8f8c537cfb6e3fde8829a5b48d078034c74a6c68 should now be good with Mopidy-Spotify==5.0.0a2. Sorry about that. |
When using that specific commit I've got a compile error
|
I managed to lose a commit along the way earlier. Fixed now |
Which commit is your latest version against Mopidy-Spotify v5.0.0a2? |
Yes |
I'm using commit
|
I swear I made that change and pushed it. Sorry for this mess. What is checked in definitely builds. I've moved on from this branch now and clearly this is too much juggling for me to cope. |
No problem! Made a build based on I'm running this build for a hour of 2 without any problems. It looks like you fixed the issue 🚀 ! If so, this would be the most stable release! |
Brilliant. Thanks for persevering and providing the feedback, it's really helpful. I'm ready for a v5.0.0a3 release (based on latest librespot and gst-plugins-rs ) as soon as librespot-org/librespot#1357 is merged since that should fix the remaining connection issues being reported. |
You could close this issue, 2 days playing non-stop without any issues, thanks @kingosticks ! |
Super. I think I'll make another beta release today rather than wait for any further upstream fixes. I think I've demonstrated my inability to juggle multiple changes. At which point I'll close this with a link to the associated gst-plugin-spotify release. I'm glad we're making progress on all this. |
I've released Mopidy-Spotify v5.0.0a3 and gst-plugin-spotify_0.14.0~alpha.1-1 with the fixes. Given how different this version is, let's start a new issue if there are still problems with track switching. |
This happens relatively often and the only way to "fix" it is to restart Mopidy entirely. This doesn't happen with other audio sources so it seems to be Spotify-specific.
With
GST_DEBUG=3
not much is logged:The text was updated successfully, but these errors were encountered: