On 500 from CDN, retry directly — never trigger re-authentication; only 403 causes authenticate()#74
On 500 from CDN, retry directly — never trigger re-authentication; only 403 causes authenticate()#74
Conversation
…sion jars Co-authored-by: paul-1 <6473457+paul-1@users.noreply.github.com>
|
There is an issue from something that caused a missing channel token. See the log |
The log in your comment was truncated — the comment system stopped parsing at what it interpreted as an XML closing tag in the log content (the message cuts off right after A few things that would help most:
In the meantime I've audited the new cookie-routing code and the path for |
|
@copilot Here is the continued log |
... The log is still being truncated at the same spot — the line after Could you share the log one of these ways instead?
The exact content of that DEBUG line (and any WARN/ERROR lines nearby) is what I need to identify the root cause. |
…e header and returned by server Co-authored-by: paul-1 <6473457+paul-1@users.noreply.github.com>
Thanks for the gist. The log made the issue clear. Root cause: Fix (commit Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
|
@copilot Still more errors in cookie refreshes See the log here: https://gist.github.com/paul-1/d46eff6d699bd80d60c6e5a6692ee49d#file-sxm-proxy-log |
…cookies Co-authored-by: paul-1 <6473457+paul-1@users.noreply.github.com>
Three separate bugs identified and fixed in commit Bug 1 — Renewal feedback loop ( Bug 2 — SXMAKTOKEN permanently lost: The SiriusXM server never returns a new Fixes applied:
|
|
@copilot when trying to play different channels at the same time. There is something getting crossed in the cookies, forcing the renew authentication back and forth. See the log https://gist.github.com/paul-1/8429540d8ecfa32e7f81c6c802f82730#file-sxm-log |
…3 loops Co-authored-by: paul-1 <6473457+paul-1@users.noreply.github.com>
Root cause identified and fixed in commit Root cause —
Fix: Moved
|
|
@copilot still seeing errors, these could be problems with the primary server, should this not have switched to try teh secondary server? |
…ver failover never triggered for playlist CDN errors Co-authored-by: paul-1 <6473457+paul-1@users.noreply.github.com>
... Your log is truncated again at the same spot — the That said, the code bug is clear from inspection alone and is fixed in The fix adds:
After 3 consecutive playlist CDN failures the proxy will now switch to the secondary server, same as it already did for segment failures. |
|
@copilot I have been seeing errors in the log like this.. When we refresh the playlist in the background, its failing. But when the client asks for the playlist, it is able to get the playlist. Something is wrong in the playlist caching. |
… channel; fix reset_channel_server undoing failover on error retries Agent-Logs-Url: https://github.com/paul-1/plugin-SiriusXM/sessions/62f9ea67-eaf1-4f29-9f00-25f90ff3deca Co-authored-by: paul-1 <6473457+paul-1@users.noreply.github.com>
The log explains exactly what happened, and two bugs were contributing. Fixed in What the log showed: At 12:33:37 the CDN returned a 500 on the background playlist refresh. The Bug 1 — Background refresh drops channel from queue on failure: Bug 2 — |
|
@copilot we seem to be seeing random http code 500's lets not force session reauthentication, just do a simple retry on code 500. [29.03.2026 12:57:38.739] DEBUG SiriusXM::get_playlist:1728: Getting playlist for channel: 9450 rework get_playlist and get_segment to just do a retry on code 500. make sure both functions are handling error codes identically. |
…g re-authentication Agent-Logs-Url: https://github.com/paul-1/plugin-SiriusXM/sessions/83528b5c-6e3d-4dcf-84d9-e030472999cc Co-authored-by: paul-1 <6473457+paul-1@users.noreply.github.com>
Done in |
|
@copilot I asked you to rework both get_playlist and get_segment for the code 500 errors, and to make sure both follow very similar code paths. also on failure, we cannot wait for the scheduler to retry in 10s, since the audio segments are only 10s long, we need to retry fairly quickly. |
…fresh retry to 2s Agent-Logs-Url: https://github.com/paul-1/plugin-SiriusXM/sessions/5b7012b4-ca9a-49cd-95fa-db61e08c3b74 Co-authored-by: paul-1 <6473457+paul-1@users.noreply.github.com>
Done in |
|
@copilot still issues with playlist handling. In the below log, it says it got 3 total failures, yet somehow after it reported 3 failures, it had a playlist to process. |
…reshold After failure #3 triggers switch_channel_server(), the immediate retry in get_playlist/get_segment still used the stale primary-server URL (already embedded in $request). If that retry succeeded, record_channel_success() reset the failure counter to 0 while channel_server was 'secondary', bypassing the 3-failure threshold entirely. Fix: capture get_channel_server() before and after record_channel_failure(). If the server changed (i.e. the switch fired), return undef immediately so the background refresh reschedules a 2-second retry and get_playlist_url() fetches a fresh URL from the new server. Same fix applied to get_segment(). Agent-Logs-Url: https://github.com/paul-1/plugin-SiriusXM/sessions/72ad1a01-cf50-410d-a154-f6f804f59074 Co-authored-by: paul-1 <6473457+paul-1@users.noreply.github.com>
... Fixed in The 4th retry bypassed the threshold because Fix: capture |
…R_FAILURE_THRESHOLD to 5 Agent-Logs-Url: https://github.com/paul-1/plugin-SiriusXM/sessions/44e479d4-5648-47df-8eea-326f783f5fcf Co-authored-by: paul-1 <6473457+paul-1@users.noreply.github.com>
Original prompt
This pull request was created from Copilot chat.
🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.