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

Abierto
#10,330 1 comentario 1 reacción 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
45/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
rust
Área
performance

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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.

Lenguaje dominante
Rust
Estrellas
1.6k
Forks
251
Merge medio
10 h 10 min
PR fusionados (30 d)
832

Preparar el entorno

Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de moq-dev/moq

Todos los issues de moq-dev/moq

Issues similares

Más issues de Rust

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.