Slow/uneven media-key re-delivery when a Matrix listener rejoins an encrypted call (follow-up to #44) #51
Labels
No labels
bug
duplicate
enhancement
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
dark/nether-voicebridge#51
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Symptom
When a Matrix listener leaves an encrypted call and rejoins, Discord speakers
become audible again only slowly and unevenly — some ghosts re-key the
returning listener within a few seconds, others take ~30-35s, so the listener
hears static/partial audio first and the main speaker can be last to come back.
Live-observed on
v0.3.0-alpha.1(Dark Voice, encrypted), listener@darkdevice
ihjNlBVX90, same device across the rejoin:The slow ghosts logged, just before finally delivering:
The audio core stayed clean throughout (
jitter_dropped=0,capture_errs=0), sothis is purely media-key re-delivery latency, not audio loss.
Likely mechanism
Fast ghosts are the ones whose cached
OlmMachine([GhostCryptoCache], #44)still held a warm Olm session to the listener's device, so re-keying was a single
encrypt +
/sendToDevice. The slow ghosts had to rebuild the session on demand(
update_tracked_users->/keys/query->get_missing_sessions->/keys/claimin
key_transport.rs::ensure_tracked_and_sessions), and that claim first wrestledwith the listener's stale offline devices (no OTKs) before reaching the live
device — all gated by
distribute_key_loop's burst/heartbeat cadence(
ghost.rs).Suspected #44 side effect (UNCONFIRMED): before #44, each ghost ran a perpetual
/syncthat kept recipient device-lists and Olm sessions warm, so a rejoin re-keyednear-instantly. #44 replaced that with on-demand query/claim (the whole point — it
retired the FD-exhaustion
/syncfan-out), which is slower to re-warm a lapsedsession. This needs an A/B against master to confirm it's actually a regression
— we only ever tested a Discord-user rejoin on master, never a listener rejoin,
so master's listener-rejoin latency is unknown and may also have been slow. Do not
assume; measure first.
Fix directions (to investigate)
active ghosts immediately and force a session re-establish, rather than letting
each ghost's loop reach it on its own cadence.
/keys/claimto the live in-call device so arejoin doesn't spend time on the listener's dead offline devices' missing OTKs
(we already target the in-call device for the send; the claim/session step may
still fan out wider).
follow-up in #44) to warm device-lists once per room instead of per ghost.
Notes
v0.3.0-alpha.1); not a blocker, but it degrades therejoin UX on encrypted calls.
fidelity question (debug-build + double-transcode/mono, not corruption).
Fixed in v0.3.0-alpha.2 (master
1bf9723). Two changes: the first key-send to a device usesRefreshMode::Force(bypasses the SDK's stale device-list cache for that recipient), and rejoin bumps a membership generation so every ghost re-sends promptly. Measured on the original repro: a rejoining listener is re-keyed by all ghosts in ~244 ms, down from the 30–35 s uneven straggle described here.The Grace/L.Ron "flicker" thread of this report was proven client-side via key-fingerprint logging — the bridge sent byte-identical keys through the flaps (the fp logging is kept for future triage).
The deeper receive-path problem (a listener whose inbound Olm session dies can't be detected by a send-only ghost) grew into #52 — max-age session rotation, shipped and closed with definitive live proof 2026-07-05 — and #55 (reactive re-key via MSC4203, blocked on Tuwunel). Closing.