core icon indicating copy to clipboard operation
core copied to clipboard

dev build: ~30 s after a Spotify favorite starts on a Sonos zone, sonn spawns a second soloist that fails with store_busy → "playback skipped" → Loxone app shows "could not be played" while audio keeps playing

Open logol01 opened this issue 6 days ago • 7 comments

Version: 4.0.0-beta.25+dev-20261128174634 (image built 2026-11-28 17:48Z), zone 16 "WC", output Sonos One (S2)

First, a follow-up to #464: on this dev build the zone now reports mode=play correctly. Thanks! The error toast in the Loxone app still shows up, though, and the log shows a different cause.

Steps Loxone starts room favorite 9 on zone 16. The favorite is a single Spotify track: audio/16/roomfav/play/9.

What happens

  • 22:00:54Z: the favorite starts, the soloist plays the track, the Sonos plays our stream, and the state is mode=play. Everything is fine.
  • Right after that, sonn tries to reach a soloist control port that never opens. It logs connect ECONNREFUSED 127.0.0.1:41757 every 250 ms for 30 s.
  • 22:01:24Z: soloist never answered on its control port (port 41757), and then the same again for a new port, 42173.
  • 22:01:56Z: soloist would not play this track with reason=store_busy, then spotify input not ready; blocking playback to avoid skips, then playback skipped; no playable source resolved. This is when the Loxone app shows "Nothing is playing in WC – … could not be played".
  • Meanwhile the first session keeps playing. Its ffmpeg runs on until 22:02:47Z (runMs=112465), and the speaker never goes silent.
  • No Loxone command arrives between 22:00:55 and 22:02:24, so the second start comes from inside sonn.

So it looks like a second soloist is started for the zone while the single-track soloist still holds the account's store. That second soloist cannot get the store (store_busy), and its failure is reported to Loxone as a failed playback of the item that is in fact playing.

There is a related line from earlier on the same zone, also on dev: single-track: playback made no progress for 60 seconds, followed by spotify playback stopped for this room.

Log (non-SPAM, zone 16, account name removed)

22:00:54.642Z [DEBUG][LoxoneHttp|Processor] [command=audio/16/roomfav/play/9] command received
22:00:55.071Z [INFO][Input|SoloistTrack] [uri=spotify:track:5qlfsiq1kUHRhZcgGznbeS zoneId=16] soloist is playing a track for this zone
22:00:55.079Z [INFO][Audio|Manager] [source=spotify title="Meeresrauschen Meditationsmusik" zoneId=16] playback started
22:00:55.333Z [DEBUG][Input|SoloistWs] [message="connect ECONNREFUSED 127.0.0.1:41757" zoneId=16] soloist control channel error
   ... repeated every 250 ms ...
22:00:55.349Z [DEBUG][Zones|StateController:Sonos] ... mode=play
22:01:24.836Z [WARN][Input|SoloistWs] [port=41757 zoneId=16] soloist never answered on its control port
22:01:56.346Z [WARN][Input|SoloistWs] [port=42173 zoneId=16] soloist never answered on its control port
22:01:56.346Z [WARN][Input|Soloist] [reason=store_busy uri=spotify:track:5qlfsiq1kUHRhZcgGznbeS zoneId=16] soloist would not play this track
22:01:56.346Z [WARN][Zones|Manager] [zoneId=16] spotify input not ready; blocking playback to avoid skips
22:01:56.346Z [WARN][Zones|Manager] [audiopath=spotify:track:5qlfsiq1kUHRhZcgGznbeS zoneId=16] playback skipped; no playable source resolved
22:02:47.540Z [INFO][Audio|Session] [code=0 runMs=112465 zoneId=16] ffmpeg exited

The full log is available on request.

logol01 avatar Nov 28 '26 22:11 logol01

Reproduced again twice tonight on 4.0.0-beta.25+dev-20261128174634, this time with a playlist room favorite (so it's not related to #470). Same timing both times, zone 16 (Sonos S2), started by presence via audio/16/roomfav/play/9:

19:01:28.454  command=audio/16/roomfav/play/9
19:01:28.742  soloist is playing a track for this zone
19:01:28.865  playback started            (audio is fine and keeps playing)
19:01:58.573  WARN soloist never answered on its control port (port A)   +30 s
19:02:30.165  WARN soloist never answered on its control port (port B)   +62 s
19:02:30.165  WARN soloist would not play this track reason=store_busy
19:02:30.165  WARN spotify input not ready; blocking playback to avoid skips
19:02:30.165  WARN playback skipped; no playable source resolved
              -> Loxone zone goes to idle, app shows "could not be played"
19:05:15.303  next track: soloist is playing a track, playback started -> state correct again

19:19:40.639  roomfav/play/9 ... identical: +30 s never answered, +62 s store_busy, playback skipped

So ~30 s after a successful start, something spawns a second soloist for the same zone/account while the first one is still streaming. The second one never answers, and its store_busy failure is reported to Loxone as a failed playback even though the first soloist keeps playing. Happy to run a DEBUG build or test a fix.

logol01 avatar Nov 29 '26 20:11 logol01

Thanks for the reproductions. Part of it is on dev now (a87ade5, from #467): the second Soloist run no longer waits a minute before its failure is reported. That doesn't explain where that second start comes from, and the toast will still show. Could you send the full DEBUG log of one occurrence on the dev build, from the roomfav command until the "playback skipped" line? Then I can see what starts the track a second time.

rudyberends avatar Nov 30 '26 09:11 rudyberends

Here is the DEBUG log of the first occurrence on 4.0.0-beta.25+dev-20261128174634 (29 Nov, zone 16 / Sonos S2), from the audio/16/roomfav/play/9 command until "playback skipped". Account name and playlist ID are redacted; the ~240 repeated "ECONNREFUSED" lines are collapsed and the multi-line Sonos message dumps / stream-request lines are left out. I can send the complete raw log if you need it.

I think the log shows where the second start comes from: it already happens at t=0, not after 30 s.

  • 19:01:28.466 and 19:01:28.473: two soloist processes are launched for zone 16 within 7 ms (control ports 42087 and 41843).
  • The second one exits immediately: Error: another session is running for data directory ".../account-<user>/data", code=1.
  • The first one (42087) connects, logs in and plays normally.
  • Sonn doesn't seem to notice that the second process already exited and keeps polling port 41843 for 30 s → soloist never answered on its control port (19:01:58.573).
  • 19:02:00.074: it starts a soloist again (port 38563), which again exits immediately with "another session is running", is polled for another 30 s, and then the failure is reported as store_busy → playback skipped (19:02:30.165), while the first soloist keeps streaming the whole time.

So it looks like a double launch per play command (plus a retry), where the losing process is only detected via the 30 s control-port timeout.

DEBUG log 19:01:28 – 19:02:30 UTC
[2026-11-29T19:01:28.454Z][DEBUG][LoxoneHttp|Processor] [command=audio/16/roomfav/play/9] command received
[2026-11-29T19:01:28.458Z][INFO][Zones|Manager] [hasParentContext=false normalizedTarget=spotify:playlist:<playlist> resolvedTarget=spotify@<user>:playlist:<playlist> station="" type=favorite uri=spotify@<user>:playlist:<playlist> zoneId=16] playContent
[2026-11-29T19:01:28.459Z][DEBUG][Content|Manager] [folderId=playlist:<playlist> limit=50 offset=0 service=spotify user=<user>] content cache hit
[2026-11-29T19:01:28.461Z][DEBUG][Zones|Manager] [expandedCount=1 isMusicAssistant=false provider=null queueSourcePath=spotify@<user>:playlist:<playlist> resolvedTarget=spotify@<user>:playlist:<playlist> zoneId=16] queue build resolved
[2026-11-29T19:01:28.461Z][DEBUG][Zones|Manager] [authority=local items=1 startIndex=0 target=spotify:track:5qlfsiq1kUHRhZcgGznbeS zoneId=16] queue rebuilt
[2026-11-29T19:01:28.466Z][DEBUG][Audio|SoloistProcess] [normalize=true quality=5 store=/app/data/soloist/account-<user>/data] soloist preferences applied
[2026-11-29T19:01:28.471Z][DEBUG][Input|SoloistWs] [message="connect ECONNREFUSED 127.0.0.1:42087" zoneId=16] soloist control channel error
[2026-11-29T19:01:28.473Z][DEBUG][Audio|SoloistProcess] [normalize=true quality=5 store=/app/data/soloist/account-<user>/data] soloist preferences applied
[2026-11-29T19:01:28.476Z][DEBUG][Input|SoloistWs] [message="connect ECONNREFUSED 127.0.0.1:41843" zoneId=16] soloist control channel error
[2026-11-29T19:01:28.482Z][DEBUG][Audio|SoloistProcess] [line="Error: another session is running for data directory \"/app/data/soloist/account-<user>/data\"." zoneId=16] soloist
[2026-11-29T19:01:28.482Z][DEBUG][Audio|SoloistProcess] [line="Stop the running session before starting soloist again." zoneId=16] soloist
[2026-11-29T19:01:28.485Z][DEBUG][Audio|SoloistProcess] [code=1 what=track zoneId=16] soloist exited
[2026-11-29T19:01:28.485Z][DEBUG][Audio|SoloistProcess] [line="2026-11-29 20:01:28.484: soloist 1.4.0.23 build 1795802503 (20261127) (gcedbef4d51) (linux/x86_64)" zoneId=16] soloist
[2026-11-29T19:01:28.485Z][DEBUG][Audio|SoloistProcess] [line="2026-11-29 20:01:28.484: client expires in 87 days" zoneId=16] soloist
[2026-11-29T19:01:28.522Z][DEBUG][Audio|SoloistProcess] [line="2026-11-29 20:01:28.522: api: websocket server listening on 127.0.0.1:42087" zoneId=16] soloist
[2026-11-29T19:01:28.522Z][DEBUG][Audio|SoloistProcess] [line="2026-11-29 20:01:28.522: ready, device_name=WC device_id=<id>" zoneId=16] soloist
[2026-11-29T19:01:28.522Z][DEBUG][Audio|SoloistProcess] [line="2026-11-29 20:01:28.522: restoring session" zoneId=16] soloist
[2026-11-29T19:01:28.522Z][DEBUG][Audio|SoloistProcess] [line="2026-11-29 20:01:28.522: running" zoneId=16] soloist
[2026-11-29T19:01:28.721Z][DEBUG][Input|SoloistWs] [port=42087 zoneId=16] soloist control channel open
[2026-11-29T19:01:28.727Z][DEBUG][Input|SoloistWs] [message="connect ECONNREFUSED 127.0.0.1:41843" zoneId=16] soloist control channel error
[2026-11-29T19:01:28.741Z][DEBUG][Audio|SoloistProcess] [line="2026-11-29 20:01:28.741: logged in as <user>" zoneId=16] soloist
[2026-11-29T19:01:28.742Z][INFO][Input|SoloistTrack] [accountId=<user> uri=spotify:track:5qlfsiq1kUHRhZcgGznbeS zoneId=16] soloist is playing a track for this zone
[2026-11-29T19:01:28.743Z][DEBUG][Audio|SoloistProcess] [line="2026-11-29 20:01:28.743: became active device" zoneId=16] soloist
[2026-11-29T19:01:28.858Z][DEBUG][Audio|SoloistProcess] [line="2026-11-29 20:01:28.858: playing spotify:track:5qlfsiq1kUHRhZcgGznbeS \"Meeresrauschen Meditationsmusik\" by \"Hanna Hofmanen\" [0:00 / 3:45]" zoneId=16] soloist
[2026-11-29T19:01:28.862Z][DEBUG][Audio|PulseCard] [clientVersion=35 id=16] audio client connected
[2026-11-29T19:01:28.863Z][INFO][Audio|PulseCard] [channels=2 corked=true format=f32le id=16 rate=44100] player opened a stream
[2026-11-29T19:01:28.863Z][DEBUG][Zones|Manager] [audiopath=spotify:track:5qlfsiq1kUHRhZcgGznbeS hasPlaybackSource=true playbackKind=pipe queueSize=1 zoneId=16] startQueuePlayback spotify
[2026-11-29T19:01:28.863Z][INFO][Audio|Manager] [hasStream=true label=spotify sourceKind=pipe zoneId=16] startWithResolvedSource
[2026-11-29T19:01:28.863Z][INFO][Audio|Manager] [handoff=false kind=pipe profiles=["mp3"] zoneId=16] starting audio engine
[2026-11-29T19:01:28.865Z][INFO][Audio|Engine] [crossfadeEnabled=false profile=mp3 source=pipe zoneId=16] audio session started
[2026-11-29T19:01:28.865Z][INFO][Audio|Manager] [sincePlayContentMs=407 source=spotify stream=<id> title="Meeresrauschen Meditationsmusik" zoneId=16] playback started
[2026-11-29T19:01:28.865Z][DEBUG][Zones|Manager] [action=play outputCount=1 outputTypes=["sonos"] zoneId=16] dispatchOutputs
[2026-11-29T19:01:28.865Z][DEBUG][Zones|PlayerListeners] [activeInput=spotify defaultVolume=24 dispatchedVolume=6 hadPendingReset=false isFreshStart=true mode=stop outputs=["sonos"] stateVolume=6 wasPlayerActive=false zoneId=16] player started: start-volume decision
[2026-11-29T19:01:28.918Z][INFO][Output|Sonos] [path=s2 volume=6 zoneId=16] Sonos volume set
[2026-11-29T19:01:28.922Z][INFO][Audio|Player:16] [playContentToStartedMs=407 profile=mp3 ready=true sincePlaybackStartedMs=57 sincePlayContentMs=464 source=spotify zoneId=16] playback first audio ready
[2026-11-29T19:01:28.945Z][DEBUG][LoxoneHttp|Processor] [command=audio/cfg/presencemode/16/off] command received
[2026-11-29T19:01:28.977Z][DEBUG][Input|SoloistWs] [message="connect ECONNREFUSED 127.0.0.1:41843" zoneId=16] soloist control channel error
[2026-11-29T19:01:29.134Z][DEBUG][Zones|StateController:Sonos] [... mode=play ... volume=6 zoneId=16] sonos state update
[2026-11-29T19:01:29.228Z][DEBUG][Input|SoloistWs] [message="connect ECONNREFUSED 127.0.0.1:41843" zoneId=16] soloist control channel error
... (~115 more identical "ECONNREFUSED 127.0.0.1:41843 ... soloist control channel error" lines, every ~250 ms; the first soloist keeps playing: [0:10], [0:20], [0:30] ...) ...
[2026-11-29T19:01:58.323Z][DEBUG][Input|SoloistWs] [message="connect ECONNREFUSED 127.0.0.1:41843" zoneId=16] soloist control channel error
[2026-11-29T19:01:58.573Z][WARN][Input|SoloistWs] [port=41843 zoneId=16] soloist never answered on its control port
[2026-11-29T19:01:59.627Z][DEBUG][Audio|SoloistProcess] [line="2026-11-29 20:01:59.627: playing spotify:track:5qlfsiq1kUHRhZcgGznbeS \"Meeresrauschen Meditationsmusik\" by \"Hanna Hofmanen\" [0:30 / 3:45]" zoneId=16] soloist
[2026-11-29T19:02:00.074Z][DEBUG][Audio|SoloistProcess] [normalize=true quality=5 store=/app/data/soloist/account-<user>/data] soloist preferences applied
[2026-11-29T19:02:00.076Z][DEBUG][Input|SoloistWs] [message="connect ECONNREFUSED 127.0.0.1:38563" zoneId=16] soloist control channel error
[2026-11-29T19:02:00.081Z][DEBUG][Audio|SoloistProcess] [line="Error: another session is running for data directory \"/app/data/soloist/account-<user>/data\"." zoneId=16] soloist
[2026-11-29T19:02:00.081Z][DEBUG][Audio|SoloistProcess] [line="Stop the running session before starting soloist again." zoneId=16] soloist
[2026-11-29T19:02:00.081Z][DEBUG][Audio|SoloistProcess] [code=1 what=track zoneId=16] soloist exited
[2026-11-29T19:02:00.328Z][DEBUG][Input|SoloistWs] [message="connect ECONNREFUSED 127.0.0.1:38563" zoneId=16] soloist control channel error
... (~118 more identical "ECONNREFUSED 127.0.0.1:38563 ... soloist control channel error" lines, every ~250 ms; first soloist still playing [0:40] ... [1:00]) ...
[2026-11-29T19:02:29.915Z][DEBUG][Input|SoloistWs] [message="connect ECONNREFUSED 127.0.0.1:38563" zoneId=16] soloist control channel error
[2026-11-29T19:02:30.165Z][WARN][Input|SoloistWs] [port=38563 zoneId=16] soloist never answered on its control port
[2026-11-29T19:02:30.165Z][WARN][Input|Soloist] [account=<user> reason=store_busy uri=spotify:track:5qlfsiq1kUHRhZcgGznbeS zoneId=16] soloist would not play this track
[2026-11-29T19:02:30.165Z][DEBUG][Zones|Manager] [audiopath=spotify:track:5qlfsiq1kUHRhZcgGznbeS hasPlaybackSource=false playbackKind=undefined queueSize=1 zoneId=16] startQueuePlayback spotify
[2026-11-29T19:02:30.165Z][WARN][Zones|Manager] [zoneId=16] spotify input not ready; blocking playback to avoid skips
[2026-11-29T19:02:30.165Z][WARN][Zones|Manager] [audiopath=spotify:track:5qlfsiq1kUHRhZcgGznbeS zoneId=16] playback skipped; no playable source resolved

logol01 avatar Nov 30 '26 11:11 logol01

Thanks, that's exactly what I needed to see: two runs are started for the same track within 7 ms, right after the queue is built, and the second one loses the account to the first. Since a87ade5 (on dev) the losing run is reported at once instead of after a minute, so the toast now shows at the start, but it still shows. I can't see yet from the code what starts that second run. Could you send the complete raw log of one occurrence, nothing condensed, from the roomfav command until "playback skipped"? Lines that look unrelated may show what triggers it.

rudyberends avatar Nov 30 '26 11:11 rudyberends

Here is the complete raw log of that occurrence (29 Nov, zone 16), from the audio/16/roomfav/play/9 command at 19:01:28.454 until "playback skipped" at 19:02:30.165 UTC, nothing condensed. Only the Spotify account name, playlist ID and device/household IDs are redacted.

sonn_466_vorfall_bereinigt.log

logol01 avatar Nov 30 '26 12:11 logol01

Your log in #474 gave it away. On presence the Miniserver sends audio/16/play and 2 ms later roomfav/play/9. The speaker has nothing to resume, so sonn resumes its own queue, and the favorite starts the same track again. Both hit Soloist at the same time and the second one lost the account. Starts on the same account now wait for each other and the later one takes over, like a skip (11d0646 on dev). Can you check if the message is gone on the next dev build?

rudyberends avatar Nov 30 '26 14:11 rudyberends

Tested on 4.0.0-beta.25+dev-20261130144304 (includes 11d0646): the presence start still sends audio/16/play and audio/16/roomfav/play/9 about 1 ms apart, but the second start now takes over cleanly (isFreshStart=false, like a skip). No more "another session is running", no store_busy, no "playback skipped" in the log, and the start volume is correct. Fixed from my side, thanks!

logol01 avatar Dec 01 '26 00:12 logol01