Skip to content

Far-forward seek into an unproduced region (loopback-HLS VOD) #141

Closed

Description

@cmcpherson274

What happened?

Far-forward seek into an unproduced region (loopback-HLS VOD): the 8 s deadline reconciles without restarting the producer, then 3×30 s segment cache-miss timeouts ride to item death — correct target state ~108 s after the seek command, with no intermediate error signal — before stage-2 reload recovers at the target

I issued a scripted seek sequence (600 s, 30 s, 302 s, 640 s) on a Jellyfin-negotiated HLS VOD
session (fMP4, ~4 s segments) of a 48 GB 4K remux.

Expected: the 4th seek to land near its target within a couple of seconds (as the first three
did), or to fail with a signal a host can act on.

Instead: on the 4th seek (gen=4, 305.9 s → 640 s) the engine hit its 8 s landing deadline,
"reconciled the clock without restarting the progressing producer," and truthfully reported
onSeekLanded at the OLD position (305.904). The producer kept grinding sequentially from ~316 s
while AVPlayer waited on the ~640 s segment through three 30-second cache-miss serve timeouts; the
third tore the connection (NSURLErrorDomain -1017 → failedToPlayToEndTime) into item death, and a
stage-2 reload finally re-anchored at the requested 640 s. A cue spanning the requested target was
logged at sourceTime=640.0 108.216 s after the seek command. (I was not watching a screen; the
evidence is log-only, and "frozen video" is my inference from the frozen consumer/clock logs.)
Occurrence: n=1. Playback was healthy afterward.

Steps to reproduce

  1. Load a large (tens-of-GB) 4K remux as a Jellyfin-negotiated HLS VOD session (fMP4, ~4 s segs).
  2. Issue seeks that each land in a freshly-produced region first (e.g. 600, 30, 302 s) — these
    restart the producer and land in 18–159 ms.
  3. Then seek far forward to a target well beyond current producer coverage (here 640 s, ~330 s
    past coverage). Observe: the 8 s deadline reconciles the clock without a producer restart, the
    consumer times out on the target segment 3× at 30 s each, item death, stage-2 reload at target.
    Note: reproduced once (n=1) on this 48 GB item; see scope below.

AetherEngine version or commit SHA

5.5.1 / 33565b2 (FFmpegBuild 2.0.0). PR #129's stalled-seek bound (5.4.1) is IN this build — this is the current seek machinery, not a stale one.

Host app

Custom / my own integration

Platform

tvOS

OS version

tvOS 26.5

Device / chip

Apple TV 4K (3rd gen, 2022) / AppleTV14,1

Playback path

Native AVPlayer

Source media (for playback bugs)

A ~48 GB 4K remux, delivered as a Jellyfin-negotiated HLS VOD session: fMP4, ~4 s segments.

Error codes / log lines

seek did not land within 8.0s (old position still buffered, rendered=305.90s buffered=312.41s);
  reconciled clock without restarting the progressing producer
onSeekLanded gen=4 landedTime=305.904        ← truthful (still the old position)
seg159: cache miss after 30006ms … early-header serve missed; closing connection for AVPlayer retry  (×3)
… NSURLErrorDomain -1017 → failedToPlayToEndTime
#93 item death … stage-2 recovery (attempt 1, pause guard bypassed)
#65 nudge did not revive the consumer; reloading item at 640.00s (requested seek target; frozen clock 305.90s)

Timeline (from command issuance): non-target landing reported at 8.134 s; stage-2 reload began at
93.132 s; cue-side-channel flow resumed at ≈105.638 s; a cue spanning the target logged at
sourceTime=640.0 at 108.216 s. Escalation was event-driven (the third cache-miss tearing the
connection), not a timer.

Anything else

Mechanism reading: the "reconciled clock without restarting the progressing producer" line is the
8 s-deadline path from PR #129 (5.4.1, in our build). Its starvation-vs-near-target heuristic
classified this far-forward target as not needing a restart (old position still buffered, producer
progressing), but the target sat ~330 s beyond producer coverage — at this bitrate the sequential
producer's time-to-fill is ≈2 minutes, far past the consumer's 3×30 s timeout budget, so "late
landing settles" could never happen. Two signals were available to gate a restart (as gens 1–3
got): the target's distance beyond producer coverage, and the consumer's request for the target
segment logged 6 ms after seek begin.

Positives worth keeping: onSeekLanded truthfully reported 305.904 rather than faking the landing;
the stage-2 reload anchored at the requested 640 s (the #93 target-anchor fix working). The
report is about the ~108-second silent gap between the command and the correct target state, with
no intermediate error or progress signal.

Honest scope (n=1): observed once. In the same run the 600/30/302 s seeks landed exactly over the
same session, and a small direct-file fixture landed 4/4 (27–750 ms). We have no direct-file run of
the 48 GB item itself, so we cannot isolate the trigger among HLS delivery, file size, and
producer-position geometry.

Related issues: #93 (this exercised its recovery machinery end-to-end; its close note's "forward
seeks remain unaffected" holds for warm cache but not for far-forward targets beyond producer
coverage), #50 (open: forward burst into unproduced segments, producer not re-anchored — same core
shape), #115 (open: a different failure of the same #65 nudge that was ineffective here), #38
(open: an in-flight-seek signal would give hosts something to act on during exactly this window).

Version note: measured at 5.5.1 with PR #129's fix present; no release 5.6.0–5.8.6 mentions this
path. Happy to re-test at current HEAD. Sanitized log excerpt (19:37:57–19:39:43) available on
request.

Heads-up on a possibly-related fix: 5.8.7 addressed an "advertised segments unproduced" case where sub-frame segments near keyframe clusters were collapsed into neighbours. That's a different root cause than this far-seek-past-producer-coverage case, but it's in the same segment-production machinery, so this may or may not be affected at HEAD. I haven't re-tested this one yet (the original observation was n=1, on a 48 GB item, on device) — happy to re-run on device if useful.

Activity

  1. added
    bug
    on Jul 19, 2026
  2. superuser404notfound commented on Jul 19, 2026

    @superuser404notfound
    Owner

    Fixed in 5.9.1. Thanks for a forensic-quality report; the two signals you named (target distance beyond producer coverage, and the consumer's request for the target segment 6 ms in) both ended up load-bearing in the fix.

    Your mechanism reading of the deadline path was right, and there was a second layer below it that made the failure inevitable before the deadline ever fired:

    1. The serve path parked the target request. Your gen 1-3 seeks each re-anchored the producer through serve-path branches that check the active producer (out-of-range fire, interior-hole coverage). The gen 4 request for seg159 hit the one branch that does not: the forward-wait window just above the resident cache maximum, which trusted the resident max as "the producer is about to write this". Your 600 s seek had left its segment band (~seg150-158) resident under the retention cache budget after later seeks moved the producer away, so the resident max belonged to a dead band while the active march was at ~seg79 (~316 s). The request therefore sat in a 30 s backpressure fetch with no restart, three times, and the third tore the connection into the -1017 / failedToPlayToEndTime item death and stage-2 reload you logged. This also explains n=1: the trigger needs the target to land within 8 segments above a dead band's top, which is exactly what 640 s over a 600 s band gave you.
    2. The 8 s deadline path declined its backstop restart. As you read it: the starvation predicate measures forward buffer at the old position (6.5 s of buffer means "healthy, progressing") and is blind to the target sitting ~330 s beyond what the march could reach inside the consumer's 3x30 s budget.

    The fix (PR #147, merged as 4d2a486) addresses both layers:

    • The forward-wait branch now keys on the active producer's write front (its high water since restart, or its anchor before the first write) instead of the resident maximum. A request beyond the reachable window re-anchors the producer immediately, the same path your gen 1-3 seeks took. Healthy catch-up backpressure one segment past the march front is unchanged.
    • The deadline backstop now also re-anchors when the pending seek target lies beyond active march coverage; starvation is no longer the only trigger. A healthy march filling toward a reachable target still keeps its progress (the fix: bound stalled seeks and recover sparse cache holes #129 behavior you flagged as worth keeping), and the deadline log line now names the new case (target beyond producer coverage), so any recurrence is directly attributable in logs like yours.

    Tests pin your device geometry red-to-green (notably: the geometry only reproduces with the retention budget present, since without it window pruning evicts the dead band and hides the bug), plus healthy catch-up backpressure, the coverage predicate spans, and the extended deadline decision table.

    On the related issues: #50 stays open (the abandoned-producer 404 variant of this family), and #38's in-flight seek signal remains the right host-facing improvement for this window; this fix removes the ~108 s silent gap in the reported shape rather than adding that signal.

    A re-test of your seek script at 5.9.1 would be very welcome. No need for the sanitized excerpt unless the re-test shows anything odd.

  3. cmcpherson274 commented on Jul 20, 2026

    @cmcpherson274
    Author
    Status note rather than a verification: we haven't re-run this one — the original
    observation was n=1 on a 48 GB item on device, and reproducing the trigger geometry
    (target just above a dead scrub band's resident top) needs that hardware sitting. Your
    two-layer root cause matches our logged geometry exactly, including why gens 1–3 survived
    and why it was n=1. We'll fold a device re-test into our next scripted hardware pass and
    report back; if it stays quiet there, we'll consider it closed-confirmed. (Adjacent data
    point from the 5.9.7 re-test of the subtitle findings: on a small local fixture, forward
    jumps into unproduced regions re-anchored the producer immediately — not the reported
    geometry, so not claimed as verification.)
    
  4. superuser404notfound commented on Jul 20, 2026

    @superuser404notfound
    Owner

    That reads exactly right, and there is no pressure to reproduce it on a clock. The trigger needs the retention band resident under a real budget, so it is inherently a big-item-on-device geometry; folding it into your next scripted hardware pass is the right place for it, and "quiet there means closed-confirmed" works for me.

    The 5.9.7 adjacent point is worth slightly more than you claim for it, though you are right not to call it verification. An immediate re-anchor on a forward jump into an unproduced region is precisely the new forward-wait behavior: the branch now keys on the producer's write front, so any target beyond the reachable window re-anchors at once. What a small local fixture cannot exercise is the specific failure, a target landing just above a dead band whose resident top outlived the producer, which only surfaces once the retention budget keeps that band around. So it is consistent with the fix without reproducing the reported shape. Same read as yours.

    I will leave #141 closed and watch for the hardware-pass result. Thanks for the precise status note.

  5. cmcpherson274 commented on Aug 4, 2026

    @cmcpherson274
    Author

    On the same fixed pin (6.3.0, tvOS 26.6, wired Apple TV hardware, 48 GB source) we ran the far-forward-seek replication: 24 posed far-seek events, zero item-death signatures (no failure-to-land, no item reload). Disclosure: our formal denominator is incomplete — 9 of 10 repetitions posed seeks; one launch stalled in startup and posed none, so this is not a complete same-protocol verification.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions