[Asterisk-code-review] app_confbridge: Fix bridge shutdown race condition. (asterisk[master])

N A asteriskteam at digium.com
Sat Sep 3 09:43:16 CDT 2022


Attention is currently required from: N A.

Hello Joshua Colp, Friendly Automation, 

I'd like you to reexamine a change. Please visit

    https://gerrit.asterisk.org/c/asterisk/+/18577

to look at the new patch set (#2).

Change subject: app_confbridge: Fix bridge shutdown race condition.
......................................................................

app_confbridge: Fix bridge shutdown race condition.

A race condition exists where if a bridge is left vacant
for a split instant, the bridge will shut down and go
away at the same instant that somebody else could be trying
to join it. The newcomer will find the conference still
in conference_bridges and thus take it and run with it.
At the same time, shutdown of the bridge completes and it
is removed from conference_bridges. This would generally
be rare since the timing must line up exactly right, but
if the timing is right, it can happen very frequently.

As a result, the newcomer will end up joining the bridge
corresponding to the original conference that is now
defunct. When the next party joins the same named bridge,
it won't be found in conference_bridges and thus a new
bridge gets created. This can happen right afterwards,
but in theory it could happen at any point after the first.

As a result, the newcomer that joined the bridge during
the shutdown ends up stranded in a bridge that isn't
known to app_confbridge anymore and will never get conferenced
with anything, since it's been removed from the list of
conferences already.

To prevent this, we now check after we join the bridge
if the same conference object is returned when searching
for it. If it isn't, then we try to join the bridge again,
which will succeed the second time since we won't find
the shutting down conference anymore.

ASTERISK-30081 #close

Change-Id: I08a440eafbf83ec4b502d1e44c3f4d44c4a522f9
---
M apps/app_confbridge.c
1 file changed, 60 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/77/18577/2
-- 
To view, visit https://gerrit.asterisk.org/c/asterisk/+/18577
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Change-Id: I08a440eafbf83ec4b502d1e44c3f4d44c4a522f9
Gerrit-Change-Number: 18577
Gerrit-PatchSet: 2
Gerrit-Owner: N A <mail at interlinked.x10host.com>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: Joshua Colp <jcolp at sangoma.com>
Gerrit-Attention: N A <mail at interlinked.x10host.com>
Gerrit-MessageType: newpatchset
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20220903/dd38636a/attachment.html>


More information about the asterisk-code-review mailing list