[asterisk-bugs] [Asterisk 0016840]: Deadlock in chan_local when obtaining locks on local_pvt->lock
Asterisk Bug Tracker
noreply at bugs.digium.com
Tue Feb 16 11:45:40 CST 2010
A NOTE has been added to this issue.
======================================================================
https://issues.asterisk.org/view.php?id=16840
======================================================================
Reported By: bzing2
Assigned To:
======================================================================
Project: Asterisk
Issue ID: 16840
Category: Channels/chan_local
Reproducibility: random
Severity: block
Priority: normal
Status: new
Asterisk Version: 1.6.2.2
JIRA:
Regression: No
Reviewboard Link:
SVN Branch (only for SVN checkouts, not tarball releases): N/A
SVN Revision (number only!):
Request Review:
======================================================================
Date Submitted: 2010-02-16 11:40 CST
Last Modified: 2010-02-16 11:45 CST
======================================================================
Summary: Deadlock in chan_local when obtaining locks on
local_pvt->lock
Description:
Deadlock condition in chan_local when two brideged threads attempt to
obtain
locks to eachothers local_pvt structures in the opposite order. All
processing of SIP traffic halts when an attempt is made to hangup the
call.
Thread A obtains a lock to its local_pvt->lock when in local_write. When
in check_bridge a call is made to ast_bridged_channel, this in turn calls
local_bridgedchannel which attempts to obtain a lock on the bridged
channels
local_pvt->lock.
Thread B follows a similar path. It holds its own lock, and during a call
to
ast_channel_masquerade again local_bridgedchannel is called. This
attempts to
obtain a lock to the bridged channel.
At this point either side has deadlocked. Then a user attempts to hangup
the
call and again local_bridgedchannel is called, and blocks while attempting
to
get the lock. Unfortunalty sip netlock is held and everything grinds to
a
halt.
======================================================================
----------------------------------------------------------------------
(0118105) bzing2 (reporter) - 2010-02-16 11:45
https://issues.asterisk.org/view.php?id=16840#c118105
----------------------------------------------------------------------
First attempt at a fix is to remove the check
p->chan->_bridge != ast_bridged_channel(p->chan)
from the beginning of check_bridge. If I understood correctly this can
only be true
when LOCAL_ALREADY_MASQED is also true, which is tested first.
Unfortunatly I
know we cant trust the flag as we were already in the process of setting
up
the masqurade when it deadlocked, what effect that has on
local_queue_frame I
do not (as yet) know.
I belive this will work mainly because one call to check_bridge has
isoutbound
true and the other is false. In the second case case no action is
preformed
whatever the result of ast_bridged_channel.
Issue History
Date Modified Username Field Change
======================================================================
2010-02-16 11:45 bzing2 Note Added: 0118105
======================================================================
More information about the asterisk-bugs
mailing list