[asterisk-dev] [Code Review] [patch] Use of MASTER_CHANNEL causes a race condition ending in a deadlock among channels

Tilghman Lesher reviewboard at asterisk.org
Fri Feb 25 14:43:38 CST 2011


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviewboard.asterisk.org/r/1127/#review3220
-----------------------------------------------------------


Could you be a little more explicit in what channel is being "potentially" locked here?  The code, as it exists today, explicitly unlocks the SIP channel and the pvt before engaging in the use of the MASTER_CHANNEL() construct, keeping merely a reference to the channel.

If the problem is within the MASTER_CHANNEL function, shouldn't this change fix that function as well?

- Tilghman


On 2011-02-25 13:40:19, Brett Bryant wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviewboard.asterisk.org/r/1127/
> -----------------------------------------------------------
> 
> (Updated 2011-02-25 13:40:19)
> 
> 
> Review request for Asterisk Developers.
> 
> 
> Summary
> -------
> 
> Use of MASTER_CHANNEL in chan_sip causes pbx_setvar_helper to potentially lock a channel before iterating through the channel container to find the master channel. This violates locking order, and when two threads are doing this at the same time they can both end up in a deadlock holding the channel locks that the others are trying to acquire through the iterator.
> 
> 
> Diffs
> -----
> 
>   /tags/1.8.3-rc2/channels/chan_sip.c 308543 
> 
> Diff: https://reviewboard.asterisk.org/r/1127/diff
> 
> 
> Testing
> -------
> 
> Tested functionality of code and accuracy before and after change which removed the use of the MASTER_CHANNEL function.
> 
> 
> Thanks,
> 
> Brett
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20110225/aa397a54/attachment-0001.htm>


More information about the asterisk-dev mailing list