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

Đang mở
#10,330 1 bình luận 1 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
45/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
rust
Lĩnh vực
performance

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.

Ngôn ngữ chính
Rust
Star
1.6k
Fork
251
Merge trung bình
10 giờ 10 phút
Pull request đã merge (30 ngày)
832

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của moq-dev/moq

Tất cả issue của moq-dev/moq

Issue tương tự

Thêm issue về Rust

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.