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

kkm reviewboard at asterisk.org
Fri Jun 17 05:42:17 CDT 2011


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

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
-----


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/20110617/00c07f70/attachment.htm>


More information about the asterisk-dev mailing list