[Home]

Summary:ASTERISK-24356: PJSIP: Directed pickup causes deadlock
Reporter:Richard Mudgett (rmudgett)Labels:
Date Opened:2014-09-25 13:32:18Date Closed:2014-10-03 12:33:33
Priority:MajorRegression?
Status:Closed/CompleteComponents:Channels/chan_pjsip
Versions:13.0.0-beta2 Frequency of
Occurrence
Frequent
Related
Issues:
is related toASTERISK-24394 CDR: FRACK with PJSIP directed pickup.
Environment:Attachments:( 0) backtrace.txt
( 1) core_show_locks.txt
( 2) jira_asterisk_24356_v13.patch
Description:Performing a directed pickup of PJSIP channels can result in a deadlock.

Steps to reproduce:
# Party A(100) calls Party B(200)
# External process uses an AMI Originate to have Party C(202) pickup the call to Party B.
# When Party C answers, a deadlock is likely to happen.

Party B and C happen to be Digium D40 phones.

Sample extensions.conf:
{noformat}
[connected_line_send]
exten = s,1,NoOp(Connected line update)
same = n,Return

[call_pickup]
exten = s,1,NoOp(Directed pickup)
same = n,PickupChan(${PICKUP_CHAN})
same = n,Hangup()

[default]
exten = 200,1,NoOp(Party A calling Party B)
same = n,Set(__CONNECTED_LINE_SEND_SUB=connected_line_send,s,1)
same = n,Dial(PJSIP/200,30,kKtT)
same = n,Hangup()
{noformat}

AMI Originate to pickup call to Party B
{noformat}
Action: Originate
CallerID: PBX <0>
Channel: PJSIP/202
Timeout: 30000
Context: call_pickup
Exten: s
Priority: 1
Account: pickmeup
Variable: PICKUP_CHAN=PJSIP/200
{noformat}

The deadlock is between the channel masquerade to pickup the call and the PJSIP channel processing a 180 Ringing message.

I think a recent change made this deadlock more likely to happen.
Comments:By: Richard Mudgett (rmudgett) 2014-09-25 13:44:00.307-0500

[^backtrace.txt] - The threads marked with BUGBUG are involved in the pickup.  Thread 4 and 2 are in deadlock.

[^core_show_locks.txt] - Captured before attaching gdb to get backtrace.

By: Richard Mudgett (rmudgett) 2014-09-29 17:07:13.401-0500

[^jira_asterisk_24356_v13.patch] - Patch that suspends the PJSIP channel serializer thread before starting a masquerade involving that channel.  This avoids the deadlock while the masquerade is fixing up the private channel pointers.