Skip to content

Health check restarts the entire daemon on session_valid=false — upstream librespot PRs might allow in-place recovery instead #146

Description

@woorszt

Problem Statement

Observed a full daemon restart triggered purely by a stale live session, credentials themselves were never the issue:

Health check restart for b8:27:eb:b3:15:27: session_valid=false
Shutting down Unified daemon for b8:27:eb:b3:15:27 (pid: 202032)
Quitting SpotOn Unified daemon for b8:27:eb:b3:15:27
daemon_stop: mac=b8:27:eb:b3:15:27 pid=202032 uptime=10150.7s
Need to create Unified daemon for b8:27:eb:b3:15:27
daemon_start: mac=b8:27:eb:b3:15:27 pid=210209 [...]

Confirmed via the Status page that this was purely a live-session issue, not a credentials problem — Auth Health showed PKCE/sp_dc both Valid for the account throughout, only the daemon process itself got recycled (old PID 202032 → new PID 210209).

Likely trigger: the player had been switched to internet radio for a while beforehand, so the Connect session sat idle — Spotify's own servers plausibly dropped the dealer/session server-side after enough inactivity. Spirc itself doesn't appear to have a built-in way to detect and recover from a server-initiated disconnect like this, so SpotOn's health check has to fall back to the bluntest available tool: restarting the whole process.

This restart was clean/fast in this instance (~130ms between stop and new port announce, no lingering errors), so not filing this as urgent — more flagging the pattern, since "switch away and back" seems like a fairly normal, recurring scenario rather than a rare edge case.

Proposed Solution

Not proposing a specific fix, since this seems to be a librespot-level limitation rather than something SpotOn's own code could easily solve alone. A few open librespot PRs target exactly this class of problem — recovering a stale/lost session without restarting the whole process:

All three are open/unmerged upstream, so not something actionable right now — just noting them alongside this observed case in case they're useful context if this pattern shows up again or gets more disruptive. No strong opinion on whether it's worth pursuing before they land upstream.

Alternatives Considered

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions