Summary:ASTERISK-22749: Deadlock during 4-way conference creation
Reporter:Kinsey Moore (kmoore)Labels:
Date Opened:2013-10-23 08:10:55Date Closed:2013-12-13 12:34:16.000-0600
Versions:12.0.0-beta1 Frequency of
Environment:4 sip phones configured for res_pjsip with direct_media=yes and extensions to be able to dial the other phones to build the conference via DTMF attended transferAttachments:( 0) lock_inversion.diff
Description:When adding channels via DTMF attended transfer to get to a 4-way bridge, lock inversion is encountered causing a 4-way deadlock. This is a result of the update_peer RTP glue callback for chan_pjsip attempting to lock the bridge while the channel is obligatorily locked. This is worked around by the attached patch, but it exposed other issues.

Beyond the fixes the patch provides, there is still one outstanding issue that needs to be resolved: the bridge_start and bridge_stop native RTP functions are called while a non-unlockable channel lock is held due to being called in a framehook callback. This is an issue because the bridge MUST be locked before calling the bridge_stop or bridge_start functions and results in a forced lock inversion.