[GH-ISSUE #1241] librespot / SPIRC crashed in the middle of the night #568

Closed
opened 2026-02-27 19:31:20 +03:00 by kerem · 6 comments
Owner

Originally created by @microfx on GitHub (Jan 16, 2024).
Original GitHub issue: https://github.com/librespot-org/librespot/issues/1241

Describe the bug
Saw that librespot is not available anymore this morning after having run for days without errors. I was sleeping and it crashed (no music was playing)

Log

Jan 16 05:02:32 librespot[1181]: [2024-01-16T04:02:32Z ERROR librespot_core::session] session lost connection to server 
Jan 16 05:02:32 librespot[1181]: [2024-01-16T04:02:32Z ERROR librespot_connect::spirc] remote update selected, but none received 
Jan 16 05:02:32 librespot[1181]: [2024-01-16T04:02:32Z WARN  librespot] Spirc shut down unexpectedly 
Jan 16 05:02:32 librespot[1181]: [2024-01-16T04:02:32Z WARN  librespot_core::apresolve] Failed to resolve all access points, using fallbacks 
Jan 16 05:02:32  librespot[1181]: [2024-01-16T04:02:32Z WARN  librespot_core::apresolve] Resolve access points error: Service unavailable { error trying to connect: dns error: failed to lookup address information: Temporary failure in name resolution } 
Jan 16 05:02:32  librespot[1181]: [2024-01-16T04:02:32Z INFO  librespot_core::session] Connecting to AP "ap.spotify.com:443" 
Jan 16 05:02:32  librespot[1181]: [2024-01-16T04:02:32Z ERROR librespot] could not initialize spirc: Unknown error { failed to lookup address information: Temporary failure in name resolution } 
Jan 16 05:02:32  systemd[1]: librespot.service: Main process exited, code=exited, status=1/FAILURE 
Jan 16 05:02:32  systemd[1]: librespot.service: Failed with result 'exit-code'. 
Jan 16 05:02:32  systemd[1]: librespot.service: Consumed 1h 13min 2.562s CPU time. 

When starting I get this - maybe is related?

librespot -v
[2024-01-16T10:00:25Z INFO  librespot] librespot 0.5.0-dev a245a3c (Built on 2023-12-23, Build ID: 0GbZXlzH, Profile: release)
[2024-01-16T10:00:25Z TRACE librespot] Command line argument(s):
[2024-01-16T10:00:25Z TRACE librespot] 		v
[2024-01-16T10:00:25Z DEBUG librespot_core::session] new Session
[2024-01-16T10:00:25Z DEBUG librespot_discovery::server] Zeroconf server listening on 0.0.0.0:39675
*** WARNING *** The program 'librespot' uses the Apple Bonjour compatibility layer of Avahi.
*** WARNING *** Please fix your application to use the native API of Avahi!
*** WARNING *** For more information see <http://0pointer.de/blog/projects/avahi-compat.html>
[2024-01-16T10:00:25Z INFO  librespot_playback::mixer::softmixer] Mixing with softvol and volume control: Log(60.0)
[2024-01-16T10:00:25Z DEBUG librespot_playback::player] new Player [0]
[2024-01-16T10:00:25Z INFO  librespot_playback::convert] Converting with ditherer: tpdf
[2024-01-16T10:00:25Z INFO  librespot_playback::audio_backend::rodio] Using Rodio sink with format S16 and cpal host: ALSA
[2024-01-16T10:00:25Z INFO  librespot_playback::audio_backend::rodio] Using audio device: default
[2024-01-16T10:00:25Z DEBUG librespot_playback::audio_backend::rodio] Rodio sink was created

Host (what you are running librespot on):
OS: Raspbian GNU/Linux 11 (bullseye) aarch64
Kernel: Linux 6.1.69-v8-16k+
Raspberry Pi 5 8GB

librespot 0.5.0-dev a245a3c (Built on 2023-12-23, Build ID: 0GbZXlzH, Profile: release)

Originally created by @microfx on GitHub (Jan 16, 2024). Original GitHub issue: https://github.com/librespot-org/librespot/issues/1241 **Describe the bug** Saw that librespot is not available anymore this morning after having run for days without errors. I was sleeping and it crashed (no music was playing) **Log** ``` Jan 16 05:02:32 librespot[1181]: [2024-01-16T04:02:32Z ERROR librespot_core::session] session lost connection to server Jan 16 05:02:32 librespot[1181]: [2024-01-16T04:02:32Z ERROR librespot_connect::spirc] remote update selected, but none received Jan 16 05:02:32 librespot[1181]: [2024-01-16T04:02:32Z WARN librespot] Spirc shut down unexpectedly Jan 16 05:02:32 librespot[1181]: [2024-01-16T04:02:32Z WARN librespot_core::apresolve] Failed to resolve all access points, using fallbacks Jan 16 05:02:32 librespot[1181]: [2024-01-16T04:02:32Z WARN librespot_core::apresolve] Resolve access points error: Service unavailable { error trying to connect: dns error: failed to lookup address information: Temporary failure in name resolution } Jan 16 05:02:32 librespot[1181]: [2024-01-16T04:02:32Z INFO librespot_core::session] Connecting to AP "ap.spotify.com:443" Jan 16 05:02:32 librespot[1181]: [2024-01-16T04:02:32Z ERROR librespot] could not initialize spirc: Unknown error { failed to lookup address information: Temporary failure in name resolution } Jan 16 05:02:32 systemd[1]: librespot.service: Main process exited, code=exited, status=1/FAILURE Jan 16 05:02:32 systemd[1]: librespot.service: Failed with result 'exit-code'. Jan 16 05:02:32 systemd[1]: librespot.service: Consumed 1h 13min 2.562s CPU time. ``` When starting I get this - maybe is related? ``` librespot -v [2024-01-16T10:00:25Z INFO librespot] librespot 0.5.0-dev a245a3c (Built on 2023-12-23, Build ID: 0GbZXlzH, Profile: release) [2024-01-16T10:00:25Z TRACE librespot] Command line argument(s): [2024-01-16T10:00:25Z TRACE librespot] v [2024-01-16T10:00:25Z DEBUG librespot_core::session] new Session [2024-01-16T10:00:25Z DEBUG librespot_discovery::server] Zeroconf server listening on 0.0.0.0:39675 *** WARNING *** The program 'librespot' uses the Apple Bonjour compatibility layer of Avahi. *** WARNING *** Please fix your application to use the native API of Avahi! *** WARNING *** For more information see <http://0pointer.de/blog/projects/avahi-compat.html> [2024-01-16T10:00:25Z INFO librespot_playback::mixer::softmixer] Mixing with softvol and volume control: Log(60.0) [2024-01-16T10:00:25Z DEBUG librespot_playback::player] new Player [0] [2024-01-16T10:00:25Z INFO librespot_playback::convert] Converting with ditherer: tpdf [2024-01-16T10:00:25Z INFO librespot_playback::audio_backend::rodio] Using Rodio sink with format S16 and cpal host: ALSA [2024-01-16T10:00:25Z INFO librespot_playback::audio_backend::rodio] Using audio device: default [2024-01-16T10:00:25Z DEBUG librespot_playback::audio_backend::rodio] Rodio sink was created ``` **Host (what you are running `librespot` on):** OS: Raspbian GNU/Linux 11 (bullseye) aarch64 Kernel: Linux 6.1.69-v8-16k+ Raspberry Pi 5 8GB librespot 0.5.0-dev a245a3c (Built on 2023-12-23, Build ID: 0GbZXlzH, Profile: release)
kerem 2026-02-27 19:31:20 +03:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@kingosticks commented on GitHub (Jan 16, 2024):

So it didn't really crash. Your network stopped working for a bit and librespot could not (immediately) reconnect, but rather than retrying, the session connection network failure causes spirc to return an error and the program to then exit. This does look like a bug in the connection retrying, librespot should handle spirc network-related errors differently as they might be recoverable.

<!-- gh-comment-id:1893701572 --> @kingosticks commented on GitHub (Jan 16, 2024): So it didn't really crash. Your network stopped working for a bit and librespot could not (immediately) reconnect, but rather than retrying, the session connection network failure causes spirc to return an error and the program to then exit. This does look like a bug in the connection retrying, librespot should handle spirc network-related errors differently as they might be recoverable.
Author
Owner

@microfx commented on GitHub (Jan 19, 2024):

Yeah... my ISP has tons of dropouts everyday... Can I maybe tell systemd to restart it? That's how mine looks:

[Unit]
Description=Librespot
After=sound.target
Wants=network-online.target
After=network.target network-online.target
After=jack.target

[Service]
LimitRTPRIO=95
LimitMEMLOCK=infinity
Environment=JACK_NO_AUDIO_RESERVATION=1
Environment=JACK_PROMISCUOUS_SERVER=jack
User=jack
Group=jack
Environment="DEVICE_NAME=hostname"
Environment="DEVICE_TYPE=speaker"
Environment="BITRATE=320"
Environment="CACHE_ARGS=--disable-audio-cache"
Environment="VOLUME_ARGS=--volume-ctrl linear --initial-volume 60"
Environment="DEVICE_TYPE=speaker"
#Environment="OUTPUT=hw:1,0"
Environment="OPTIONS=--username myusername --password mypassword --onevent /SCRIPTS/p5_speaker_onoff.sh"
ExecStartPre=/bin/sleep 4
ExecStart=/usr/bin/librespot --name ${DEVICE_NAME} --device-type ${DEVICE_TYPE} --bitrate ${BITRATE} $CACHE_ARGS $VOLUME_ARGS $OPTIONS --backend rodiojack
[Install]
WantedBy=multi-user.target
<!-- gh-comment-id:1900303746 --> @microfx commented on GitHub (Jan 19, 2024): Yeah... my ISP has tons of dropouts everyday... Can I maybe tell systemd to restart it? That's how mine looks: ``` [Unit] Description=Librespot After=sound.target Wants=network-online.target After=network.target network-online.target After=jack.target [Service] LimitRTPRIO=95 LimitMEMLOCK=infinity Environment=JACK_NO_AUDIO_RESERVATION=1 Environment=JACK_PROMISCUOUS_SERVER=jack User=jack Group=jack Environment="DEVICE_NAME=hostname" Environment="DEVICE_TYPE=speaker" Environment="BITRATE=320" Environment="CACHE_ARGS=--disable-audio-cache" Environment="VOLUME_ARGS=--volume-ctrl linear --initial-volume 60" Environment="DEVICE_TYPE=speaker" #Environment="OUTPUT=hw:1,0" Environment="OPTIONS=--username myusername --password mypassword --onevent /SCRIPTS/p5_speaker_onoff.sh" ExecStartPre=/bin/sleep 4 ExecStart=/usr/bin/librespot --name ${DEVICE_NAME} --device-type ${DEVICE_TYPE} --bitrate ${BITRATE} $CACHE_ARGS $VOLUME_ARGS $OPTIONS --backend rodiojack [Install] WantedBy=multi-user.target ```
Author
Owner

@microfx commented on GitHub (Jan 19, 2024):

I'll add

Restart=on-failure
RestartSec=5s

and report back if that fixed it.

<!-- gh-comment-id:1900306983 --> @microfx commented on GitHub (Jan 19, 2024): I'll add ``` Restart=on-failure RestartSec=5s ``` and report back if that fixed it.
Author
Owner

@microfx commented on GitHub (Feb 14, 2024):

I guess it's fixed. Still a few other weird issues – I will look into those now. Thx!

<!-- gh-comment-id:1944716477 --> @microfx commented on GitHub (Feb 14, 2024): I guess it's fixed. Still a few other weird issues – I will look into those now. Thx!
Author
Owner

@SailingSailing commented on GitHub (Mar 3, 2025):

Yeah... my ISP has tons of dropouts everyday... Can I maybe tell systemd to restart it? That's how mine looks:

[Unit]
Description=Librespot
After=sound.target
Wants=network-online.target
After=network.target network-online.target
After=jack.target

[Service]
LimitRTPRIO=95
LimitMEMLOCK=infinity
Environment=JACK_NO_AUDIO_RESERVATION=1
Environment=JACK_PROMISCUOUS_SERVER=jack
User=jack
Group=jack
Environment="DEVICE_NAME=hostname"
Environment="DEVICE_TYPE=speaker"
Environment="BITRATE=320"
Environment="CACHE_ARGS=--disable-audio-cache"
Environment="VOLUME_ARGS=--volume-ctrl linear --initial-volume 60"
Environment="DEVICE_TYPE=speaker"
#Environment="OUTPUT=hw:1,0"
Environment="OPTIONS=--username myusername --password mypassword --onevent /SCRIPTS/p5_speaker_onoff.sh"
ExecStartPre=/bin/sleep 4
ExecStart=/usr/bin/librespot --name ${DEVICE_NAME} --device-type ${DEVICE_TYPE} --bitrate ${BITRATE} $CACHE_ARGS $VOLUME_ARGS $OPTIONS --backend rodiojack
[Install]
WantedBy=multi-user.target

Hey there, which file is this? /etc/systemd/system.conf?

<!-- gh-comment-id:2695425733 --> @SailingSailing commented on GitHub (Mar 3, 2025): > Yeah... my ISP has tons of dropouts everyday... Can I maybe tell systemd to restart it? That's how mine looks: > > ``` > [Unit] > Description=Librespot > After=sound.target > Wants=network-online.target > After=network.target network-online.target > After=jack.target > > [Service] > LimitRTPRIO=95 > LimitMEMLOCK=infinity > Environment=JACK_NO_AUDIO_RESERVATION=1 > Environment=JACK_PROMISCUOUS_SERVER=jack > User=jack > Group=jack > Environment="DEVICE_NAME=hostname" > Environment="DEVICE_TYPE=speaker" > Environment="BITRATE=320" > Environment="CACHE_ARGS=--disable-audio-cache" > Environment="VOLUME_ARGS=--volume-ctrl linear --initial-volume 60" > Environment="DEVICE_TYPE=speaker" > #Environment="OUTPUT=hw:1,0" > Environment="OPTIONS=--username myusername --password mypassword --onevent /SCRIPTS/p5_speaker_onoff.sh" > ExecStartPre=/bin/sleep 4 > ExecStart=/usr/bin/librespot --name ${DEVICE_NAME} --device-type ${DEVICE_TYPE} --bitrate ${BITRATE} $CACHE_ARGS $VOLUME_ARGS $OPTIONS --backend rodiojack > [Install] > WantedBy=multi-user.target > ``` Hey there, which file is this? `/etc/systemd/system.conf`?
Author
Owner

@kingosticks commented on GitHub (Mar 4, 2025):

No. See https://github.com/librespot-org/librespot/wiki/Running-as-a-service

<!-- gh-comment-id:2695875966 --> @kingosticks commented on GitHub (Mar 4, 2025): No. See https://github.com/librespot-org/librespot/wiki/Running-as-a-service
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/librespot#568
No description provided.