Repository navigation
Conversation
Quest-Claim: 75018eca7aedf69f
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…oom it can use Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… finish the quest Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
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.
Finishes quest/m1/pool-pinned-debt.md.
Problem
Sometimes a relay's cache target sits below what it can never evict: each live track's newest group. That happens with
cache.headroom = "100%", or on any host whose available memory is below the headroom. The pool then stays over capacity for good, and two things go wrong:used <= capacity, which never happens again. So every readerRecord::settlepicks ends withLagged(TooFarBehindon the wire). Onmain,moq export fmp4through such a relay loses its opus rendition this way every time.Evicted.Approach
pinnedcounter covers each live edge's fixed costs (entry overhead and codec state), its content once the group finished, and each track's spare encoder. It is fed by theFootprintthat already bills sessions'live_edges. A secondFINALflag bit keeps each count exact across races, as theEDGEbit already does.max(capacity, pinned). The pool's excess over that target drives everything: debt accrual, forgiveness, held-head reclaim, andhold. A pool held past its capacity by pins alone owes nothing. A track's debt is capped at the unpinned bytes, which is all eviction could ever free.Reader::endsnow also needsPool::room() > 0, meaning capacity above the pins. Ending a reader in a pool held past its capacity by pins frees room nothing may use.live_edgesbudget still sheds both kinds.Decisions
The user was away, so I took these choices myself. Each is open to review:
live_edgesbudget as the only bounds. Peers have nolive_edgesbound by default.max(capacity, pinned), notcapacity + pinned. Above the pins, capacity still counts live edges, so the headroom governor's math (used + available - headroom) is unchanged.frame_only_writer_payscaught.Impact
Pool::pinned,excess, androomare crate-private.mainwhile the capacity is above the pins.Validation
moq-relaywith[cache] headroom = "100%",moq import ts(lite-07,bbb5s_cbr.tsat real time), andmoq export fmp4for 10 s. The scripts are in the worktree's.tmp/repro.main, 2 runs: the relay logssubscribed error track=1.opus err=laggedboth times, the export logsrendition failed ... 1.opus ... too far behind, and it writes 66–67 KB.laggedand nofetch started. The export writes 73–95 KB. The opus rendition skips 6–11 groups of 100–400 ms that were evicted just after they left the live edge. That is the history loss the quest accepts under a zero target.headroom = "0": 104 KB, no skips.a_pool_below_its_live_edges_still_serves_themfails onmainwithEvictedreading the catalog's latest frame, and passes here.a_live_edge_pins_what_no_eviction_reclaimschecks that the pins follow every add, shed, finish, and demote, and return to zero.a_debt_past_the_pins_ends_no_readerfails when theroom() > 0condition is removed, and shows the same debt ends the reader once there is room.just checkpasses (11186 tests).Caused by
used <= capacity, which pinned live edges can make unreachable (found by person).The headroom governor becoming the default (moq-dev/moq#9269) exposed both on hosts with little free memory.
Alternatives
capacitybelow the same sum.a_reported_flood_folds_or_ends_the_readercaught it).Follow-ups
None. The
fetch startedwalk the quest observed belongs to lite06-fill-walk.Models
Size: M
Implementer: Claude, claude-opus-5-5, unknown effort (arm B)
🤖 Generated with Claude Code
Review
Rewritten by
quest reviewafter each round.Head: 2d97f2c, named in full once no reviewer reports a finding
Base: origin/main at 040a566
Risk: medium,
It is a bug fix in shipped moq-net cache eviction: a relay pool held over capacity by pinned live edges now serves new readers their latest group and stops ending readers for unusable room, which could change what relays deliver and which readers end, but the public API, wire format, and auth are untouched and a revert undoes it all, so it is not high; the RISK.md doc and quest-plan deletion are low.Classified: medium by Claude Code, claude-haiku-5-5, low effort, session
7886e894-6af0-4f9a-9918-6b21b064bcceReviewer: Codex, gpt-6.1-sol, high effort
Session:
01a20410-1d2e-7772-ae02-5d045dd0d2f1, round 1Score: 4/10,
The cache-pressure handling needs rework because reader records can grow without bound and shared payload retained by finished copies is undercounted as pinned.Rounds: 1; first round 2 (high 1, medium 1); findings 2 (high 1, medium 1): fixed 0, refuted 0, open 2
Findings, open until the next round settles them:
rs/moq-net/src/model/cache.rs:1930:Preserve a memory bound for records when pins exhaust capacityrs/moq-net/src/model/cache.rs:1476:Pin shared payload retained by a finished sibling