mirror of
https://github.com/livekit/livekit.git
synced 2026-03-31 13:15:42 +00:00
On migration, when subscription moved from remote -> local, transceiver caching was racing. Although a very small possibility, it could happen like so 1. down track close 2. down track close callback fires go routine to close subscribed track 3. subscribed track close handler in subscription manager tries to reconcile 4. reconcile adds subscribed track again 5. cannot find cached transceiver as caching happens after down track close finishes in stap 1 above. Although there are a couple of gortouine jumps (step 2 fires a goroutine to close subscribed track and step 4 will reconcile in a goroutine too), it is theoretically possible that the step 1 has not finished and hence transceiver is not cached. Fix is to move caching to before closing subscribed track.