This request fixes a race condition caused by close and addChannel mutating the reference to SctpConnection and channelForDtls. This can result in a stack trace causing a cast exception. The result is the participant in the conference receives no media.
The fix is a simple synchronize block, since there is a tight connection between the value of the sctpConnection and channelForDtls and two areas where these values can be mutated - addChannel and close. I looked for any chances of dead-locks by carefully analyzing any locks obtained within the new synchronize block and didn't find any; I also ensured all areas that read and write these variables are done while the lock is held, which turned out to be the same areas, allowing for this simpler approach.
Load testing this fix reveals no race conditions are occurring now. The previous pull request made the situation much better, but didn't cover all cases.
You can view, comment on, or merge this pull request online at:
-- Commit Summary --
* Fix: race condition between addChannel() and close() when assigning sctpConnection AND channelForDtlsLock
-- File Changes --
M src/main/java/org/jitsi/videobridge/IceUdpTransportManager.java (164)
-- Patch Links --
Reply to this email directly or view it on GitHub: