[asterisk-dev] [Code Review]: Fix deadlock between subscription event RWLOCK and dialogs container lock in chan_sip. (simplified)
mjordan
reviewboard at asterisk.org
Fri Nov 4 09:42:19 CDT 2011
> On Nov. 3, 2011, 4:57 p.m., mjordan wrote:
> > sip_subscribe_mwi_sip_destroy is still directly destroying the dialog related to the sip_subscription_mwi. I have a feeling that will do some interesting things, and may be good to snag as well with this patch, since you're influencing how sip dialogs are destroyed.
>
> rmudgett wrote:
> What sip_subscribe_mwi_destroy() is doing is definitely bad and looks to lead into a can of worms. However, it is outside the scope of this deadlock issue. This patch is not changing how SIP dialogs are destroyed in general. It is changing how a specific path destroys dialogs.
No problem with that - but lets file a bug report against so it doesn't get dropped
- mjordan
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviewboard.asterisk.org/r/1564/#review4677
-----------------------------------------------------------
On Nov. 3, 2011, 6:29 p.m., rmudgett wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviewboard.asterisk.org/r/1564/
> -----------------------------------------------------------
>
> (Updated Nov. 3, 2011, 6:29 p.m.)
>
>
> Review request for Asterisk Developers, David Vossel and schmidts.
>
>
> Summary
> -------
>
> Timing between dialog destruction and a MWI event sending a message could result in a deadlock.
>
> Order of events causing deadlock:
>
> 1a) The event subscription system calls the registered callbacks with its list RWLOCK held.
> 1b) The SIP monitor checks for dialogs needing destruction. It does an ao2_callback that holds the dialogs container lock while searching for dialogs to destroy.
> 2a) The event subscription SIP callback needs to create a temporary dialog to send out the MWI notification. That temporary dialog needs to be inserted in the dialogs container so it must wait.
> 2b) The dialog search finds a dialog to destroy and as a result releases the last reference for a peer. The peer destructor attempts to get the subscription RWLOCK but must wait.
> 3) deadlock
>
>
> This is based off of the original diff posted for review: https://reviewboard.asterisk.org/r/1557/
>
> It directly addresses the comment dvossel posted to the original diff of https://reviewboard.asterisk.org/r/1557/
>
>
> This addresses bug ASTERISK-18747.
> https://issues.asterisk.org/jira/browse/ASTERISK-18747
>
>
> Diffs
> -----
>
> /branches/1.8/channels/chan_sip.c 343338
>
> Diff: https://reviewboard.asterisk.org/r/1564/diff
>
>
> Testing
> -------
>
> It compiles. :)
>
>
> Thanks,
>
> rmudgett
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20111104/52c222e7/attachment-0001.htm>
More information about the asterisk-dev
mailing list