Skip to content

A backward scrub reads as consumer silence: the #65 backpressure park counts cache wakeups as seconds, and a receding fetch target never resets the wedge timer #528

Closed

Description

@superuser404notfound

Found while reading the 6.75.0 capture attached to #496 (49 s of backward scrubbing, 33 seek generations, 23 re-anchors). The subtitle side of that log is clean, which is what the capture was taken for. This is a separate finding in the same file, on the video path.

What the log shows

09:55:32.002  GET .../seg185.mp4
09:55:32.002  #65 backpressure PARK (advance) head=220 target=210 cacheTarget=185 highStored=219 cached=106 parked=22s (no playback progress)
09:55:32.044  #3 timeControlStatus=playing reason=- t+17.64s
09:55:32.047  GET .../seg181.mp4
09:55:32.047  declareTarget backward jump 185 -> 181: resident through seg219 (march front 219), no restart
09:55:32.138  GET .../seg182.mp4
09:55:32.138  #65 backpressure WEDGE BROKEN (advance) head=220 target=210 cacheTarget=182 parked=24s consumerTargetStored=y highStored=219 cached=106; exiting pump for host re-anchor on AVPlayer position
09:55:32.141  seg-220.m4s partial at teardown (151023 B) discarded, not adopted
09:55:32.141  pump finished: reason=backpressureWedge packetsRead=14338 packetsWritten=4801 lastError=0 elapsed=10145ms cacheCount=106
09:55:32.141  #421 backpressure wedge with seg181 already stored: the consumer is silent on content it can have, so nudging it before touching the producer
09:55:32.141  #65 re-engaging stalled AVPlayer (wedge re-anchor): nudge seek to 728.30s

The consumer was not silent. It issued a new segment GET every ~100 ms across the whole park, AVPlayer reported playing 94 ms before the trip, and the seeks were landing (seek#31 programmatic landed rendered=728.30). The wedge breaker fired into a session where nothing was stuck, threw away a 151 KB partial segment and 10.1 s of muxing work, re-anchored the producer and nudge-seeked AVPlayer in the middle of the viewer's scrub. Every trip also consumes one of the five maxConsecutiveWedgeReanchors, so the budget for a real wedge is spent on scrubbing.

Two independent defects have to be true at once for this, and both are worth fixing on their own.

1. The park counts wakeups, not seconds

SegmentCache.awaitFetchHighWater is a single condition.wait(until:), and declareTarget broadcasts on every target change, so every consumer GET wakes the parked pump early. awaitBackpressureRelease then does parked += 1 per iteration and feeds the wedge detector once per iteration, so both count wakeups.

The log measures it directly:

time parked
09:55:29.602 12s
09:55:32.002 22s
09:55:32.138 24s

Ten "seconds" in 2.400 s of wall clock, and the whole 24 "second" break threshold inside a pump whose exit line reads elapsed=10145ms. The busier the consumer, the faster the timer that is supposed to measure its silence. The 12 s log threshold, the 24 s break and the 5 s fast path all ride on the same counter.

The same shape is in the #207 disk park (awaitPrefetchDiskHeadroom, identical early return, parked += 1 per iteration), whose doc comment states "this loop polls once a second, like the advance park". The live headroom park is the one that is right: it sleeps a real second.

2. A receding fetch target reads as a frozen one

BackpressureWedgeDetector holds a monotone maxTargetSeen and resets stuckSeconds only on currentTarget > maxTargetSeen. A viewer scrubbing backwards declares a LOWER target on every GET (194, 185, 182 across the three lines above), so against a high-water mark the busiest consumer in the session is indistinguishable from one that stopped fetching altogether.

The detector already carries three false-positive guards (paused consumer, pre-first-frame, advancing target). This is a fourth case, and it is not another guard: the question the detector means to ask is whether the consumer is still fetching, and a fetch target that MOVED is a fetch, whichever direction it moved in.

Fix shape

Credit to RadicalMuffinMan for the capture: the seek storm in it is what made the false trip visible.

Activity

  1. added
    bug
    on Sep 11, 2026
  2. superuser404notfound commented on Sep 11, 2026

    @superuser404notfound
    OwnerAuthor

    Fixed in bdde1843, merged to main as 7665bfad, not released yet.

    Both halves are in. ParkClock turns the two VOD park loops' wakeups into seconds, which costs a real wedge nothing: a wedged consumer broadcasts nothing, so its park already ran at one second per second, and only a park behind a BUSY consumer was running fast. The stuck detector resets on any target move rather than only on an advance, while the fast path keeps requiring a non-advancing target so the #35/#79 scrub burst that renders nothing still breaks in single digits.

    The PARK line now carries stuck=, which is the field this investigation had to reconstruct from cacheTarget deltas across log lines:

    #65 backpressure PARK (advance) head=141 target=131 cacheTarget=77 highStored=140 cached=140 parked=12s stuck=0s (consumer still fetching)
    

    Measured A/B with aetherctl seektest --seeks 30 --gap-ms 300 against a 10 minute 4 Mbps H.264 file. The harness reproduces the field shape exactly on the old build (parked 12 to 22 in 1.799 s of wall clock, the 24 s breaker inside a pump that had lived 9784 ms), and the two runs are otherwise identical: 981 samples, maxWedge 0.28 s, 2 producer restarts, 155 ledger segments on both sides. Before: 2 parks, 1 wedge break, 1 re-anchor, 1 nudge seek. After: 1 park, no break, and seektest says so in its verdict instead of reading a healthy park as an unrecovered wedge.

    That the viewer-facing numbers are identical is the measure of what the false trip was worth: it threw away a partial segment and the pump's forward work to repair a session that was not broken.

  3. added a commit that references this issue on Sep 11, 2026
  4. superuser404notfound commented on Sep 11, 2026

    @superuser404notfound
    OwnerAuthor

    Released in 6.81.0 (bdde1843, merged as 7665bfad). Both consumers are pinned to it.

    Closing: this was found in a log rather than reported, the A/B under aetherctl seektest is identical on the player side, and there is no reporter waiting on a retest.

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