Spotifyd / spotifyd

A spotify daemon
https://spotifyd.rs
GNU General Public License v3.0
9.79k stars 447 forks source link

Timeout in API request causes panic, but spotifyd doesn't exit fully #793

Closed iFreilicht closed 2 years ago

iFreilicht commented 3 years ago

Description Spotifyd will randomly crash on my machine. Sometimes during playback, sometimes while paused. After running spotifyd --no-daemon, I managed to catch the error message:

Couldn't fetch metadata from spotify: Err(RateLimited(Some(1)))
Couldn't fetch metadata from spotify: Err(RateLimited(Some(1)))
Caught panic with message: called `Result::unwrap()` on an `Err` value: reqwest::Error { kind: Request, url: "https://api.spotify.com/v1/me/player", source: TimedOut }

Additionally, spotifyd doesn't exit fully when this happens:

$ prep spotifyd # While running
383908
383959
$ prep spotifyd # After crashing
383908

I always have to pkill spotifyd before starting it again, else Spotify on my phone is not going to detect the new instance.

I am aware the rate limiting is my fault, I have a script to show the current track using playerctl and it runs playerctl quite frequently.

To Reproduce

  1. Start spotifyd
  2. Play music through it
  3. Wait for crash

Expected behavior I would expect spotifyd to handle timeouts gracefully, and to shut down fully when it crashes.

Logs The log is about 36.5MiB, I compressed and attached it. spotifyd.tar.gz

Versions (please complete the following information):

robinvd commented 3 years ago

Definitly a bug that should be fixed, thanks for reporting!

JojiiOfficial commented 3 years ago

That RateLimit error seems to be interesting too. Is this a known issue?

robinvd commented 3 years ago

ive read about ratelimit issues before but not seen the error in a log like this

willthong commented 3 years ago

I have exactly the same issue and receive the same error message. I am also using a `playerctl' script to show the current playing track.

Versions:

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

iFreilicht commented 3 years ago

@stale It was confirmed and hasn't been fixed yet.

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

adrianomitre commented 2 years ago

I am suffering from same issue both on spotifyd 0.3.2 and on the most current commit as of this message on Ubuntu 20.04.3 LTS (5.11.0-36-generic).

$ spotifyd --no-daemon
Loading config from "/home/<redacted>/.config/spotifyd/spotifyd.conf"
No proxy specified
Using alsa volume controller.
Couldn't read volume from alsa device with name "default".
Connecting to AP "guc3-accesspoint-a-x7kn.ap.spotify.com:443"
Authenticated as "<redacted>" !
Using alsa sink
Couldn't set volume: "Couldn't find selem with name 'PCM'."
Running "" using "/usr/bin/zsh" with environment variables {"PLAYER_EVENT": "volumeset", "VOLUME": "65535"}
Country: "BR"
Running "" using "/usr/bin/zsh" with environment variables {"PLAYER_EVENT": "start", "TRACK_ID": "75D5cH21X8jAVdRKuUR70B", "PLAY_REQUEST_ID": "0", "POSITION_MS": "134"}
Running "" using "/usr/bin/zsh" with environment variables {"PLAYER_EVENT": "load", "PLAY_REQUEST_ID": "0", "TRACK_ID": "75D5cH21X8jAVdRKuUR70B", "POSITION_MS": "134"}
Loading <Didn't I Blow Your Mind This Time> with Spotify URI <spotify:track:75D5cH21X8jAVdRKuUR70B>
<Didn't I (Blow Your Mind This Time)> (201066 ms) loaded
Running "" using "/usr/bin/zsh" with environment variables {"DURATION_MS": "201066", "TRACK_ID": "75D5cH21X8jAVdRKuUR70B", "POSITION_MS": "133", "PLAYER_EVENT": "pause", "PLAY_REQUEST_ID": "0"}
Running "" using "/usr/bin/zsh" with environment variables {"DURATION_MS": "201066", "POSITION_MS": "133", "PLAY_REQUEST_ID": "0", "PLAYER_EVENT": "play", "TRACK_ID": "75D5cH21X8jAVdRKuUR70B"}
Running "" using "/usr/bin/zsh" with environment variables {"DURATION_MS": "201066", "POSITION_MS": "152", "PLAYER_EVENT": "play", "TRACK_ID": "75D5cH21X8jAVdRKuUR70B", "PLAY_REQUEST_ID": "0"}
Running "" using "/usr/bin/zsh" with environment variables {"TRACK_ID": "75D5cH21X8jAVdRKuUR70B", "PLAYER_EVENT": "preload", "PLAY_REQUEST_ID": "0"}
Loading <I Gotcha> with Spotify URI <spotify:track:40L8MWZPJ1imFgv5S3atRY>
<I Gotcha> (132813 ms) loaded
Running "" using "/usr/bin/zsh" with environment variables {"TRACK_ID": "75D5cH21X8jAVdRKuUR70B", "PLAYER_EVENT": "endoftrack", "PLAY_REQUEST_ID": "0"}
Running "" using "/usr/bin/zsh" with environment variables {"OLD_TRACK_ID": "75D5cH21X8jAVdRKuUR70B", "PLAYER_EVENT": "change", "TRACK_ID": "40L8MWZPJ1imFgv5S3atRY"}
Running "" using "/usr/bin/zsh" with environment variables {"TRACK_ID": "40L8MWZPJ1imFgv5S3atRY", "POSITION_MS": "0", "PLAYER_EVENT": "play", "PLAY_REQUEST_ID": "1", "DURATION_MS": "132813"}
Running "" using "/usr/bin/zsh" with environment variables {"PLAYER_EVENT": "preload", "PLAY_REQUEST_ID": "1", "TRACK_ID": "40L8MWZPJ1imFgv5S3atRY"}
Loading <Since I First Met You> with Spotify URI <spotify:track:0vGyXveSjPnALkLiqfZDOg>
<Since I First Met You> (140773 ms) loaded
Running "" using "/usr/bin/zsh" with environment variables {"PLAY_REQUEST_ID": "1", "PLAYER_EVENT": "endoftrack", "TRACK_ID": "40L8MWZPJ1imFgv5S3atRY"}
Running "" using "/usr/bin/zsh" with environment variables {"PLAYER_EVENT": "change", "OLD_TRACK_ID": "40L8MWZPJ1imFgv5S3atRY", "TRACK_ID": "0vGyXveSjPnALkLiqfZDOg"}
Running "" using "/usr/bin/zsh" with environment variables {"PLAY_REQUEST_ID": "2", "TRACK_ID": "0vGyXveSjPnALkLiqfZDOg", "PLAYER_EVENT": "play", "POSITION_MS": "0", "DURATION_MS": "140773"}
Running "" using "/usr/bin/zsh" with environment variables {"TRACK_ID": "0vGyXveSjPnALkLiqfZDOg", "PLAY_REQUEST_ID": "2", "PLAYER_EVENT": "preload"}
Loading <Foolish Heart> with Spotify URI <spotify:track:46gsGxk2iUctmgJUmQRTKz>
Reducing normalisation factor to prevent clipping. Please add negative pregain to avoid.
<Foolish Heart> (217293 ms) loaded
Running "" using "/usr/bin/zsh" with environment variables {"TRACK_ID": "0vGyXveSjPnALkLiqfZDOg", "PLAYER_EVENT": "endoftrack", "PLAY_REQUEST_ID": "2"}
Running "" using "/usr/bin/zsh" with environment variables {"OLD_TRACK_ID": "0vGyXveSjPnALkLiqfZDOg", "PLAYER_EVENT": "change", "TRACK_ID": "46gsGxk2iUctmgJUmQRTKz"}
Running "" using "/usr/bin/zsh" with environment variables {"TRACK_ID": "46gsGxk2iUctmgJUmQRTKz", "PLAYER_EVENT": "play", "PLAY_REQUEST_ID": "3", "POSITION_MS": "0", "DURATION_MS": "217293"}
Running "" using "/usr/bin/zsh" with environment variables {"PLAY_REQUEST_ID": "3", "PLAYER_EVENT": "preload", "TRACK_ID": "46gsGxk2iUctmgJUmQRTKz"}
Loading <Now You're All Alone - From "The Hateful Eight" Soundtrack> with Spotify URI <spotify:track:3SvXeAE6Io29kxfyHjK3H2>
Reducing normalisation factor to prevent clipping. Please add negative pregain to avoid.
<Now You're All Alone - From "The Hateful Eight" Soundtrack> (89551 ms) loaded
Running "" using "/usr/bin/zsh" with environment variables {"PLAYER_EVENT": "endoftrack", "PLAY_REQUEST_ID": "3", "TRACK_ID": "46gsGxk2iUctmgJUmQRTKz"}
Running "" using "/usr/bin/zsh" with environment variables {"TRACK_ID": "3SvXeAE6Io29kxfyHjK3H2", "OLD_TRACK_ID": "46gsGxk2iUctmgJUmQRTKz", "PLAYER_EVENT": "change"}
Running "" using "/usr/bin/zsh" with environment variables {"POSITION_MS": "0", "PLAYER_EVENT": "play", "TRACK_ID": "3SvXeAE6Io29kxfyHjK3H2", "PLAY_REQUEST_ID": "4", "DURATION_MS": "89551"}
Running "" using "/usr/bin/zsh" with environment variables {"PLAY_REQUEST_ID": "4", "PLAYER_EVENT": "preload", "TRACK_ID": "3SvXeAE6Io29kxfyHjK3H2"}
Loading <Two Hearts> with Spotify URI <spotify:track:3qFSNhAr1AnMjFXZZ4pwgq>
Reducing normalisation factor to prevent clipping. Please add negative pregain to avoid.
<Two Hearts> (214600 ms) loaded
Running "" using "/usr/bin/zsh" with environment variables {"PLAYER_EVENT": "endoftrack", "TRACK_ID": "3SvXeAE6Io29kxfyHjK3H2", "PLAY_REQUEST_ID": "4"}
Running "" using "/usr/bin/zsh" with environment variables {"OLD_TRACK_ID": "3SvXeAE6Io29kxfyHjK3H2", "TRACK_ID": "3qFSNhAr1AnMjFXZZ4pwgq", "PLAYER_EVENT": "change"}
Running "" using "/usr/bin/zsh" with environment variables {"PLAYER_EVENT": "play", "TRACK_ID": "3qFSNhAr1AnMjFXZZ4pwgq", "PLAY_REQUEST_ID": "5", "POSITION_MS": "0", "DURATION_MS": "214600"}
Running "" using "/usr/bin/zsh" with environment variables {"PLAY_REQUEST_ID": "5", "PLAYER_EVENT": "preload", "TRACK_ID": "3qFSNhAr1AnMjFXZZ4pwgq"}
Unable to load audio item.
Os { code: 104, kind: ConnectionReset, message: "Connection reset by peer" }
stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.