Skip to content
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

Connection reset by peer (os error 104) #1306

Open
1 of 6 tasks
dc-850 opened this issue Oct 15, 2024 · 14 comments
Open
1 of 6 tasks

Connection reset by peer (os error 104) #1306

dc-850 opened this issue Oct 15, 2024 · 14 comments
Labels
bug A functionality or parts of a program that do not work as intended

Comments

@dc-850
Copy link

dc-850 commented Oct 15, 2024

Description
Every time I start spotifyd, it plays for about an hour or two and then goes from the play state to idle. When I check journalctl, it says "subscription terminated." followed by "Connection reset by peer". After that, it starts the authentication process again. I'm not exactly sure what to do or what could be causing this.

To Reproduce

  1. Launch spotifyd with
/usr/local/bin/spotifyd --no-daemon --config-path /home/pi/.config/spotifyd/spotifyd.conf --cache-path /home/pi/.cache/spotifyd/
  1. Start playing
  2. Playstate goes from playing to idle in random intervals

Logs

Click to show logs
Oct 15 07:32:38 raspberrypi spotifyd[1024]: subscription terminated
Oct 15 07:32:38 raspberrypi spotifyd[1024]: Connection reset by peer (os error 104)
Oct 15 07:32:38 raspberrypi spotifyd[1024]: Ignoring blacklisted access point ap-gew4.                                                                                                                                                             spotify.com:4070
Oct 15 07:32:38 raspberrypi spotifyd[1024]: Ignoring blacklisted access point ap-gew4.                                                                                                                                                             spotify.com:443
Oct 15 07:32:38 raspberrypi spotifyd[1024]: Ignoring blacklisted access point ap-gew4.                                                                                                                                                             spotify.com:80
Oct 15 07:32:38 raspberrypi spotifyd[1024]: Connecting to AP "ap-gew1.spotify.com:443"
Oct 15 07:32:38 raspberrypi spotifyd[1024]: Authenticated as "xxxx" !
Oct 15 07:32:38 raspberrypi spotifyd[1024]: Mixing with softvol and volume control: Lo                                                                                                                                                             g(60.0)
Oct 15 07:32:38 raspberrypi spotifyd[1024]: Converting with ditherer: tpdf
Oct 15 07:32:38 raspberrypi spotifyd[1024]: Using AlsaSink with format: S16

Compilation flags

  • dbus_mpris
  • dbus_keyring
  • alsa_backend
  • portaudio_backend
  • pulseaudio_backend
  • rodio_backend

Versions (please complete the following information):

  • OS: Raspberry Pi OS (64-bit)
@dc-850 dc-850 added the bug A functionality or parts of a program that do not work as intended label Oct 15, 2024
@alepez
Copy link

alepez commented Oct 16, 2024

Isn't this #706?

@MrZoltan
Copy link

I have the same issue and it's a regular one.
Oct 22 23:21:01 HTZ100 spotifyd[3939169]: subscription terminated Oct 22 23:21:01 HTZ100 spotifyd[3939169]: Connection reset by peer (os error 104)
I can play some playlist and at some point the device is disconnected from spotify on mobile, I select the device in the list and it connect again without issue until it happen again.

I have the pulseaudio backend with Pipewire

@not4smurf
Copy link

Isn't this #706?

I don't think it is. Not for me at least. In #706 people are talking about having to restart and VPN and/or WiFi switching maybe causing it.

I'm not using a VPN, the box running spotifyd is wired, not WiFi. My connection to spotifyd just drops (the song keeps playing - output just reverts to my phone speaker). I simply select my spotifyd server as the output device and output quickly switches back to spotifyd.

Here's my log for today with just "Loading" and "loaded" stripped out:

Oct 24 18:02:35 puck spotifyd[18745]: Ignoring blacklisted access point ap-gue1.spotify.com:4070
Oct 24 18:02:35 puck spotifyd[18745]: Ignoring blacklisted access point ap-gue1.spotify.com:443
Oct 24 18:02:35 puck spotifyd[18745]: Ignoring blacklisted access point ap-gue1.spotify.com:80
Oct 24 18:02:35 puck spotifyd[18745]: Connecting to AP "ap-gae2.spotify.com:443"
Oct 24 18:02:36 puck spotifyd[18745]: Authenticated as "__redacted__" !
Oct 24 18:02:36 puck spotifyd[18745]: Country: "AU"
Oct 24 18:02:36 puck spotifyd[18745]: Mixing with softvol and volume control: Log(60.0)
Oct 24 18:02:36 puck spotifyd[18745]: Converting with ditherer: tpdf
Oct 24 18:02:36 puck spotifyd[18745]: Using AlsaSink with format: S32
Oct 24 18:40:36 puck spotifyd[18745]: subscription terminated
Oct 24 18:40:36 puck spotifyd[18745]: Connection reset by peer (os error 104)
Oct 24 18:40:53 puck spotifyd[18745]: Ignoring blacklisted access point ap-gue1.spotify.com:4070
Oct 24 18:40:53 puck spotifyd[18745]: Ignoring blacklisted access point ap-gue1.spotify.com:443
Oct 24 18:40:53 puck spotifyd[18745]: Ignoring blacklisted access point ap-gue1.spotify.com:80
Oct 24 18:40:53 puck spotifyd[18745]: Ignoring blacklisted access point ap-gew4.spotify.com:80
Oct 24 18:40:53 puck spotifyd[18745]: Connecting to AP "ap-gae2.spotify.com:443"
Oct 24 18:40:54 puck spotifyd[18745]: Authenticated as "__redacted__" !
Oct 24 18:40:54 puck spotifyd[18745]: Country: "AU"
Oct 24 18:40:54 puck spotifyd[18745]: Mixing with softvol and volume control: Log(60.0)
Oct 24 18:40:54 puck spotifyd[18745]: Converting with ditherer: tpdf
Oct 24 18:40:54 puck spotifyd[18745]: Using AlsaSink with format: S32

It just happened once today. It's not unusual for it to happen 3-4 times in a session (a few hours).

@dc-850
Copy link
Author

dc-850 commented Nov 4, 2024

My solution is to migrate to Librespot, which has resolved this issue with a new 'keep-alive' system.

@MrZoltan
Copy link

MrZoltan commented Nov 4, 2024

My solution is to migrate to Librespot, which has resolved this issue with a new 'keep-alive' system.

Unfortunately my backend isn't supported by librespot (Pipewire) so I would love to have a fix for spotifyd

@Adept9559
Copy link

I'm also running into this same issue. I now see that I'm using librespot as well. Same issue.

[2024-11-05T23:59:04Z ERROR librespot_core::session] Connection reset by peer (os error 104)
[2024-11-05T23:59:04Z ERROR librespot_connect::spirc] subscription terminated
[2024-11-05T23:59:04Z WARN librespot] Spirc shut down unexpectedly
[2024-11-05T23:59:04Z WARN librespot_core::apresolve] Ignoring blacklisted access point ap-gue1.spotify.com:443
[2024-11-05T23:59:04Z INFO librespot_core::session] Connecting to AP "ap-guc3.spotify.com:4070"
[2024-11-05T23:59:05Z INFO librespot_core::session] Authenticated as "redact" !
[2024-11-05T23:59:05Z INFO librespot_playback::mixer::softmixer] Mixing with softvol and volume control: Log(60.0)
[2024-11-05T23:59:05Z INFO librespot_playback::convert] Converting with ditherer: tpdf
[2024-11-05T23:59:05Z INFO librespot_playback::audio_backend::pulseaudio] Using PulseAudioSink with format: S16
[2024-11-05T23:59:05Z INFO librespot_core::session] Country: "CA"

@D4vid04
Copy link

D4vid04 commented Nov 6, 2024

Try creating a new cache folder and run Librespot with the options --cache and --access-token. Perhaps authorizing directly with the access token will prevent the subscription from terminating.

@eladyn
Copy link
Member

eladyn commented Dec 30, 2024

Even though this might not be a duplicate of #706, maybe the fixes in #1317 / #1321 still work?

@Exceen
Copy link

Exceen commented Dec 30, 2024

Even though this might not be a duplicate of #706, maybe the fixes in #1317 / #1321 still work?

I had your #1317 pull request running all day without any issues. mpris seems to be faster as well. thanks for your work!!!

@mvforell
Copy link

mvforell commented Jan 2, 2025

I used to have random disconnects after an hour max., but yesterday I listened for multiple hours with no problems using a build of #1317. Also, previously MPRIS stopped working after connecting and disconnecting from another client a few times, that seems to be fixed as well. Huge thanks from me as well :)

@eladyn
Copy link
Member

eladyn commented Jan 2, 2025

Note that the bulk part of the work on stability and everything has been done by librespot devs, so that credit goes to them. But thanks a lot for testing the branch!

@MrZoltan
Copy link

MrZoltan commented Jan 4, 2025

I would like to try that too but I am not familiar with the process. How do I test #1317 ? Is it in the source on "Spotifyd/spotifyd.git" or on "eladyn/spotifyd.git" ?
Thanks!

@eladyn
Copy link
Member

eladyn commented Jan 4, 2025

@MrZoltan You have indeed several options, but the easiest one is probably either the github CLI (gh pr checkout 1317) or git directly (git fetch origin pull/1317/head:deps_upgrade; git checkout deps_upgrade).

@MrZoltan
Copy link

MrZoltan commented Jan 7, 2025

@eladyn Thanks a lot for the help! It wasn't so easy but I managed to work it out in the end. It now seem that the "Connection reset by peer (os error 104)" does not appearing anymore and that is a big relief, again thanks for that. I can't help but notice that now when skipping track there is an sound artefact for a very brief moment SkipTrack->Silence->Noise->Start of next track. should I maybe write another issue with that ? It was not present before.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A functionality or parts of a program that do not work as intended
Projects
None yet
Development

No branches or pull requests

9 participants