Repository navigation
fix(live): the HLS ingest rides out an origin's refusals instead of ending the session - #778
Conversation
…nding the session An IPTV panel that limits an account's connections answers a live playlist refresh with 509 while another device holds the last slot, and goes on refusing a session it evicted while a fresh session from the loaded URL is admitted at once. The ingest retried 1, 2 and 4 s apart and went terminal at 12 s (on the software path, the end of the session), and each refusal armed the origin's request pacer, so the host's reload waited up to 10 s for its first request. - A refused or unreachable refresh (429, 5xx, transport) is asked again every second, or after the origin's Retry-After up to 5 s, for up to 60 s; a refused segment likewise, after its two quick retries. - A session URL the loaded URL led to through redirects is asked for afresh through the loaded URL once refused twice in a row, or at once when it answers as gone (a 4xx other than 429 and 408). The tracker follows MEDIA-SEQUENCE, so the segments continue where they left off. - The live ingest's refusals no longer arm OriginRequestBudget's pacer or lower its request budget; a ceiling the host declares or another path learns still binds it. Tests: HLSLiveIngestRefusalTests.
follow-up) PR #778 gave every failed refresh and segment fetch 60 s of steady retries, transport errors and any 5xx included. A dead channel or a lost network then sat behind a spinner for up to a minute (measured 59.7 s on the loopback) before the host's reopen or fallback got a turn. Only the refusal statuses (429, 503, 509) get the 60 s budget now; anything else keeps the 12 s that bridges a single CDN timeout. A retry loop keeps the longest budget it has seen, so one transport blip inside a refusal window does not end it. The playlist Retry-After is also cleared before every attempt, so a value left over from an earlier refusal is never applied to a later one. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01WJcXkGQrMiBPixVEFTSBJS
|
Thank you, this is an excellent PR. The field logs made the failure easy to follow, and the before/after numbers (15 refusal windows in 3 minutes, each bridged in about 2.5 s) are exactly the evidence this needed. Merged in b5d9a1e, full suite green on top of current main. One follow-up landed on main in a16ad60:
On the pacer question: keeping the live ingest's own refusals off the books is fine. A 15 s quiet is never the right answer on a live path, and the steady 1 s retry is a reasonable pace on its own. No One question, if it is easy to check on that panel: are the segment URLs bound to the session too (e.g. Not released yet; it will go out with the next AetherEngine tag. |
An IPTV panel that limits an account's connections answers a live playlist refresh with 509 while another device on the account holds the last slot. It goes on refusing the session it evicted, while a fresh session from the loaded URL is admitted at once. The live HLS ingest handles that badly in two ways, and together they turn a recoverable refusal into a lost session plus a 10 s wait.
OriginRequestBudget's pacer for the origin (a quiet of up to 15 s, then a 2 s token bucket), and halves its request budget for the rest of the process. The host's reload, or the native path's reopen, then waits up to 10 s for its first request, against an origin that would answer it at once.From the field
The setup: an IPTV host on macOS 26 playing a live HLS source whose loaded URL redirects to a tokenized session URL, on a connection-limited account, with a second device on the account changing channels. Times are relative to the first refusal.
Before, on the software path:
That was 15.5 s of black, 10 of them in the pacer. On the native path the same ladder ended in a reopen that also waited 10 s in the pacer: the terminal, then 10.5 s to the pacer's line, then the reopen succeeded 15.2 s after the terminal.
With the steady retries and no pacer, before the re-resolve on refusal was added, on the software path, in two refusal windows:
With this change, on the native path: 15 refusal windows in 3 minutes, each ended by a fresh session 2.3 to 2.6 s after its first refusal, with no rebuffer, no stall and no terminal.
One of the 15 fresh sessions came back with its timestamps restarted. The producer rebased it, then its no-cut stall heuristic ("likely SSAI ad pod") asked the host to retune, which cost a 1.24 s reload. That heuristic is outside this change.
The change
I know the pacer and the backoff exist for origins that punish rapid retries (#307, #377, #380). If you'd rather keep the live ingest on the books, I'm happy to rework that part instead, for example as a quiet capped at the origin's Retry-After or about 1 s, or as a
LoadOptionsswitch.Tests
HLSLiveIngestRefusalTests, new, in a loopback origin:The refused refresh, refused segment and revoked session URL cases fail on
main: terminal, and the pacer armed.Suites run:
DocumentedConstantsTests,PublicAPIDocumentationTestsand the ingest suites pass.Full suite: passes apart from
HLSLocalServerSlowPeerTests"LAN peers cannot take the slots kept for loopback". It times out the same way on unmodifiedmainon this machine, where the test runner cannot connect to its own LAN address.Test plan: macOS 26. A live HLS source whose loaded URL redirects to a tokenized session URL, behind a connection-limited IPTV panel, with a second device on the account changing channels. Measured on the software path before the change, and on the native path with it.