[asterisk-dev] [Code Review]: BLF Subscriptions Causes SIP Deadlock

David Vossel reviewboard at asterisk.org
Fri Nov 4 12:57:29 CDT 2011



> On Nov. 4, 2011, 12:35 p.m., mjordan wrote:
> > trunk/channels/chan_sip.c, line 25012
> > <https://reviewboard.asterisk.org/r/1563/diff/2/?file=21625#file21625line25012>
> >
> >     Same here with respect to unlocking / locking p

It is going to be best to clear all locks before calling sip_send_mwi_to_peer().

This is weird, but it is possible in some really strange edge case that the peer->mwipvt accessed in the send_mwi function is not the same as the sip_pvt locked before entering this function.  Since we lock the peer->mwipvt now during the transmit function we should enter the sip_send_mwi_to_peer with no locks held to guarantee no deadlocks occur due to two sip_pvt locks being held at the same time.   It is also safer not to hold the sip_peer and sip_pvt lock at the same time when at all possible.  If we enter the function with a sip_pvt locked we can not guarantee this.

Also, this function has the potential to block because of the voicemail count function which may access the disk.  If recursive locks are held before this function is executed, we can not guarantee all locks are let go when the voicemail count is retrieved.


- David


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


On Nov. 4, 2011, 11:16 a.m., opticron wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviewboard.asterisk.org/r/1563/
> -----------------------------------------------------------
> 
> (Updated Nov. 4, 2011, 11:16 a.m.)
> 
> 
> Review request for Asterisk Developers and David Vossel.
> 
> 
> Summary
> -------
> 
> Fix a locking inversion that causes deadlocks during BLF subscriptions.
> 
> 
> This addresses bug ASTERISK-18663.
>     https://issues.asterisk.org/jira/browse/ASTERISK-18663
> 
> 
> Diffs
> -----
> 
>   trunk/channels/chan_sip.c 342600 
> 
> Diff: https://reviewboard.asterisk.org/r/1563/diff
> 
> 
> Testing
> -------
> 
> Compile
> 
> 
> Thanks,
> 
> opticron
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20111104/3ffa4d19/attachment.htm>


More information about the asterisk-dev mailing list