[asterisk-dev] [Code Review] Deadlock due to lock order inversion in ast_async_goto()

kkm reviewboard at asterisk.org
Fri Jun 17 21:04:19 CDT 2011


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


Discarding in favor of a more thorough change by dvossel: https://reviewboard.asterisk.org/r/1275/

- kkm


On 2011-06-17 05:51:01, kkm wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviewboard.asterisk.org/r/1274/
> -----------------------------------------------------------
> 
> (Updated 2011-06-17 05:51:01)
> 
> 
> Review request for Asterisk Developers and David Vossel.
> 
> 
> Summary
> -------
> 
> ast_async_goto() grabs a channel lock, and then calls ast_channel_alloc(), which in turn locks the channels container to insert the newly allocated channel into it. That causes nasty deadlocks on servers under load.
> 
> I moved the locking of the channel down to after a masquerade channel is allocated.
> 
> I do not know how safe it is to assume that the value of (!chan->pbx) won't change while in ast_channel_alloc(). Is a more complex synchronization required here?
> 
> 
> This addresses bug ASTERISK-18031.
>     https://issues.asterisk.org/jira/browse/ASTERISK-18031
> 
> 
> Diffs
> -----
> 
>   tags/1.8.4.2/main/pbx.c 324106 
> 
> Diff: https://reviewboard.asterisk.org/r/1274/diff
> 
> 
> Testing
> -------
> 
> Deployed the fix on production servers suffering from deadlocks. They did neither melt nor explode from it, but whether the problem is fixed, I do not know yet. Need to monitor for 2-3 days to be sure.
> 
> 
> Thanks,
> 
> kkm
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20110618/18945bdc/attachment.htm>


More information about the asterisk-dev mailing list