Repository navigation
fix(seek): re-anchor producer for far-forward seeks above retained scrub bands (#141) - #147
Merged
Conversation
…rub bands A far-forward VOD seek whose target sat just above a dead scrub band's resident top parked in 3x30 s cache-miss serve timeouts (restarted=false), tore the connection into -1017 item death, and only reached the target via stage-2 reload ~108 s after the seek command (issue #141, n=1 device log). Two layers misread the geometry: - VideoSegmentProvider's forward-wait branch (r.1 < index <= r.1 + window) read the resident max as "the producer is about to write this". With the #93 retention budget, r.1 can belong to a dead producer's band far above the active march (band 150-158 from a 600 s scrub; producer re-anchored at 75, front ~79; request seg159). The branch now keys on the active producer's write front, max(highWater since restart, lastRestartIndex), and re-anchors when the request is beyond the reachable window. In normal single-band operation the front equals r.1, so behavior there is unchanged. - The 8 s seek-deadline path (#129) kept the "progressing" producer because the old position still had forward buffer (seekIsWedged=false), blind to the pending target sitting ~330 s beyond the march. The deadline backstop now also re-anchors when the pending target lies beyond active march coverage (activeMarchCovers via producerCoversPlaylistTime); a healthy march filling toward a reachable target still keeps its progress. The 30 s forward backpressure wait is now injectable for tests (production default unchanged). New Issue141FarForwardSeekTests pin the device geometry (restart fires, no 30 s park), healthy catch-up backpressure, and the march-coverage predicate; RecoverySeekTargetTests pins the extended deadline decision table. Fixes #141. Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01NAPCg4tCDdSqkK6tPkNptw
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.
Summary
Fixes #141: a far-forward VOD seek whose target sat just above a retained (dead) scrub band's resident top parked in three 30 s cache-miss serve timeouts, tore the loopback connection into
-1017/failedToPlayToEndTimeitem death, and only reached the requested target via stage-2 reload roughly 108 s after the seek command.Root cause
The reporter's scripted sequence (600 s, 30 s, 302 s, 640 s) built exactly the one geometry the serve path trusts blindly:
r.1 < index <= r.1 + 8). That branch read the resident max as "the producer is about to write this" and parked the request in the 30 s backpressure fetch with no restart, three times. The gen 1-3 seeks all took branches that DO check the active producer (out-of-range, interior-hole coverage), which is why only the fourth seek died.seekIsWedgedsaw 6.5 s of forward buffer at the old position (healthy, progressing) and "reconciled the clock without restarting the progressing producer". The target sat ~330 s beyond the march; at that bitrate the sequential fill needs ~2 minutes, far past the consumer's 3x30 s budget, so a late landing was structurally impossible.Fix
Two layers, matching the two misreads:
max(highWater since restart, lastRestartIndex), instead of the resident maximum. A request beyondfront + forwardWaitWindowre-anchors the producer immediately. In normal single-band operation the front equalsr.1, so healthy catch-up backpressure is unchanged.shouldReanchorProducerAfterSeekDeadlinenow also re-anchors when the pending seek target lies beyond active march coverage (producerCoversPlaylistTime->activeMarchCovers). Starvation is no longer the only trigger; a healthy march filling toward a reachable target still keeps its progress (fix: bound stalled seeks and recover sparse cache holes #129 semantics preserved).The deadline log line now names the third case (
old position still buffered, target beyond producer coverage ... and re-anchored producer at ...), so a recurrence is directly attributable in reporter logs.Testing
Issue141FarForwardSeekTests: device geometry red-to-green (restart fires instead of a 30 s park; with the stale band resident under a retention budget, the pre-fix code parks the full injected wait and serves nil), healthy catch-up still backpressure-waits with no restart, and theactiveMarchCoversspan (anchor-to-front + window, cold-start anchor window, behind-anchor and beyond-window excluded).RecoverySeekTargetTestspins the extended deadline decision table (starved, target-beyond-coverage, both, neither).🤖 Generated with Claude Code
https://claude.ai/code/session_01NAPCg4tCDdSqkK6tPkNptw