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

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


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

(Updated 2011-06-17 05:51:01.504885)


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 (updated)
-----

  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/20110617/cf6cb49f/attachment-0001.htm>


More information about the asterisk-dev mailing list