moq-relay: --stats-enabled breaks --cache-capacity when subscribers rejoin often — memory grows without limit

Aperta
#10,330 1 commento 1 reazione 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
45/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
rust
Ambito
performance

Direzione di ricerca

Start with TrackState::pay_debt in track.rs and trace how stats-enabled session tagging affects cache_accessed() for groups when a subscriber rejoins. Compare eviction behavior with stats enabled and disabled, using the reproduction settings in the issue. Done means the cache respects --cache-capacity during repeated rejoins with stats enabled, without changing the reported stats behavior.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Bottom line: With --stats-enabled, the relay stops evicting cached groups once subscribers rejoin a live track every few seconds. Memory then grows at the track's full ingest rate and never stops. Without --stats-enabled, the cache cap works. Seen on 0.17.10 and 0.17.18.

How to reproduce

  • One publisher, one live track at about 1.9 Mbit/s.
  • One subscriber that replaces its session every 6 seconds: open a new session, subscribe, then close the old one.
  • Run the relay with --cache-capacity 16MiB --stats-enabled.
  • Watch the relay's memory for 15 minutes.

What happens (relay memory, 0.17.10)

Setup Growth
16MiB cap, stats off none, flat at about 32 MiB
16MiB cap, stats on +10 MiB/min, 162 MiB after 15 min
128MiB cap, stats on +10 MiB/min, 409 MiB after 40 min
0.17.18, 16MiB cap, stats on +10 MiB/min
Stats on, one subscriber that never rejoins none
Stats on, rejoin every 90 s about +0.08 MiB/min

The growth equals the ingest rate, so every group is being kept.

What we found

  • Memory profile: all the growth is frame data from the publisher's writes.
  • In TrackState::pay_debt (track.rs), with stats on, most groups are skipped as "recently used" (cache_accessed() > average), so the cache never gets back under its cap. In one run, 456 groups were skipped and 45 evicted. With stats off, 0 were skipped and 94 evicted.
  • It isn't the .stats publisher or the byte counters. Turning off just the stats session tagging (Handle::session returning Session::default) stops the growth. Turning off everything else doesn't.

What we don't know: which part of the session tagging keeps those groups looking recently used.

Lingua principale
Rust
Stelle
1.6k
Fork
251
Merge medio
10h 10m
PR unite (30g)
832

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di moq-dev/moq

Tutte le issue di moq-dev/moq

Issue simili

Altre issue su Rust

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.