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

N A asteriskteam at digium.com
Wed May 25 17:38:28 CDT 2022


Hello Friendly Automation, 

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

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

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.

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
real and will never get conferenced with anything, since
it's been removed from the list of conferences already.

To prevent this, we now explicitly check during shutdown
and abort if the conference status is now empty. Additionally,
we set a flag to prevent newcomers from joining the old
bridge. On the join side, we ignore bridges that are shutting
down to ensure we don't join a dead bridge, and, importantly,
do not release the lock between the time the conference is
found and the conference state changes, to ensure that
an imminent shutdown will abort afterwards.

ASTERISK-30081 #close

Change-Id: I2a704dd7dd449bf008a1ee90768ddf95c28bae0d
---
M apps/app_confbridge.c
M apps/confbridge/include/confbridge.h
2 files changed, 34 insertions(+), 2 deletions(-)


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

Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Change-Id: I2a704dd7dd449bf008a1ee90768ddf95c28bae0d
Gerrit-Change-Number: 18576
Gerrit-PatchSet: 2
Gerrit-Owner: N A <mail at interlinked.x10host.com>
Gerrit-Reviewer: Friendly Automation
Gerrit-MessageType: newpatchset
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20220525/a22731eb/attachment.html>


More information about the asterisk-code-review mailing list