Files
amethyst/quic/src
Claude bfc983bff7 feat(quic): retire fully-settled streams to keep tracker bounded under audio-room churn
Soak target #1 from the audio-rooms hardening pass: moq-lite over QUIC
mints one peer-uni stream per Opus frame, so a 3-hour broadcast at
~50 frames/sec accumulated ~540 000 stream entries in
`QuicConnection.streamsList` / `streams` for the lifetime of the
session. The two structures were append-only — closed streams were
filtered out of the writer's iteration but never removed — and the
heap grew monotonically.

Adds `QuicStream.isFullyRetired` plus `retireFullyDoneStreamsLocked`
on the connection. The writer drains the retire pass at the top of
`buildApplicationPacket`, dropping streams whose send side has
peer-acked FIN/RESET and whose receive side has both FIN'd and
fully drained into the application's incoming Channel. The
cumulative receive high-water folds into `retiredStreamsRecvBytes`
so the connection-level MAX_DATA accounting in
`appendFlowControlUpdates` keeps advertising the lifetime total —
without that seed, retiring K bytes would silently regress the
peer's send credit.

Also adds soak target #6 coverage: `QuicConnectionDriver` now
exposes `driverJob` / `closeTeardownJob` for test assertion, and
the new `QuicConnectionDriverLifecycleTest` cycles 100 sessions
against a localhost UDP blackhole to pin idempotent close +
bounded thread growth.

Tests:
 - `StreamRetirementSoakTest` (4 cases): local-uni FIN+ACK
   retirement, peer-uni listener-path retirement, MAX_DATA accounting
   preservation across retire, and a 10 000-stream churn harness
   that asserts the working set stays bounded.
 - `QuicConnectionDriverLifecycleTest` (2 cases): close idempotency
   and 100-session thread-leak canary.

https://claude.ai/code/session_018KPKWRg5baX5Anf7zfEyec
2026-05-07 23:44:13 +00:00
..