Repository navigation
fix(player): never request a fenced segment after its refusal - #488
Merged
Merged
Conversation
A fragment loader could pass the ledger's entry check before another attempt for the same URL was refused, then reach the wire after the fence was recorded. Refusing a URL now aborts every in-flight load for it, so the entry check is not the only authority. The rebuilt generation is a different URL and still loads.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Related issue: N/A
Validation tasks: none
A segment URL the server has already refused can still be requested again when a generation rotates. During a stress run, one URL produced:
There was no remount, no second
playback/start, noDELETE, and the element'ssrcdid not change. This was hls.js's queued fragment load for the refused URL.The ledger guard runs at the fragment loader's
load()entry. A load can pass that check while another attempt for the same URL is still being refused, then issue its request after the refusal is recorded. The guard cannot stop a load that has already entered. The rebuilt generation at 20.145 is a different URL (sgenadvanced) and must still load.Approach
Recording a fence now aborts every in-flight load for that exact URL. A load that passed the entry check before the refusal is cancelled before the base loader sends it, so the refusal remains final wherever the load is in its lifecycle.
The loader releases its own failed load before recording the refusal. Without that order, refusing a URL would abort the request that just produced the 412 and deliver both an abort and an error to hls.js.
The abort matches the exact URL, not the generation. The rebuilt generation keeps loading, and the existing per-URL fence and one-answer claim are unchanged.
Validation
pnpm exec tsc -bpasses.pnpm run lint: 0 errors, 84 pre-existing warnings.vitest runforfencedSegments,fencedPlaylist, andVideoPlayer: 317 tests pass.prettier --checkon both changed files passes.expected []/ received the fenced URL). Restoring the change makes it pass, and the rebuilt generation still succeeds.--no-verify: the pre-push full-treelint-changedstep exhausted disk in a Go package this branch does not touch. The web checks above ran separately; no Go files changed.Risks
None identified. The new abort applies only to an exact URL already answered with 412, and the rebuilt generation uses a different URL. A duplicate load cancelled in the deferred-send window reports hls.js's normal abort path; the ledger still answers its retry locally.
Checklist
AI Disclosure
git,gh,pnpm, Vitest, TypeScript, ESLint, Prettierdeepseek-v4.1-flash:1017(providerollama-cloud)