[jitsi-dev] [jitsi-videobridge] Fix: race condition between addChannel() and close() when assigning SctpConnection (#81)


#1

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 uses an AtomicReference to keep track of the SctpConnection reference as a guard; there was still a race condition with with ChannelForDtls, however. Since the flow was a bit more complex, I introduced a simple synchronized block with a lock. I looked for any chances of dead-locks by carefully analyzing any locks obtained within the new synchronize block and didn't find any.

Although this uses a couple of different concurrent solutions, I think the compareAndSet approach allows us to have the smallest synchronized() block that we can and be lock free in the guard case.
You can view, comment on, or merge this pull request online at:

  https://github.com/jitsi/jitsi-videobridge/pull/81

-- Commit Summary --

  * fix(SctpConnection Race): Race condition between addChannel() and close() when assigning SctpConnection

-- File Changes --

    M src/main/java/org/jitsi/videobridge/IceUdpTransportManager.java (131)

-- Patch Links --

https://github.com/jitsi/jitsi-videobridge/pull/81.patch
https://github.com/jitsi/jitsi-videobridge/pull/81.diff

···

---
Reply to this email directly or view it on GitHub:
https://github.com/jitsi/jitsi-videobridge/pull/81


#2

Closed #81.

···

---
Reply to this email directly or view it on GitHub:
https://github.com/jitsi/jitsi-videobridge/pull/81#event-388130319


#3

was this closed by accident?

···

---
Reply to this email directly or view it on GitHub:
https://github.com/jitsi/jitsi-videobridge/pull/81#issuecomment-133273200