[asterisk-bugs] [JIRA] (ASTERISK-27090) PJSIP: Deadlock using TCP transport

Richard Mudgett (JIRA) noreply at issues.asterisk.org
Wed Jun 28 13:16:58 CDT 2017


Richard Mudgett created ASTERISK-27090:
------------------------------------------

             Summary: PJSIP: Deadlock using TCP transport
                 Key: ASTERISK-27090
                 URL: https://issues.asterisk.org/jira/browse/ASTERISK-27090
             Project: Asterisk
          Issue Type: Bug
      Security Level: None
          Components: Resources/res_pjsip
    Affects Versions: 13.16.0
            Reporter: Richard Mudgett


Deadlock due to a lock inversion. In the attached back trace you can see that thread 177 is holding a lock on the transport:
{noformat}
#14 0x05a11a62 in ioqueue_dispatch_read_event (ioqueue=0x971de70, h=0x9716588) at ../src/pj/ioqueue_common_abs.c:591
        read_op = 0xa94e499c
        bytes_read = 3278
        has_lock = 1
        rc = 0
{noformat}
This same thread then requests a lock on the dialog 0xaf3a428c:
{noformat}
#5  0x08ed4468 in pjsip_dlg_inc_lock (dlg=0xaf3a428c) at ../src/pjsip/sip_dialog.c:847
{noformat}
 However the dialog's (0xaf3a428c) lock is being held by thread 53 by the following:
{noformat}
#17 0x08ed53ba in pjsip_dlg_send_response (dlg=0xaf3a428c, tsx=0xb6684ec4, tdata=0xb180be84) at ../src/pjsip/sip_dialog.c:1478
        status = -1234852344
......
#25 0x08ed58c9 in pjsip_dlg_on_rx_request (dlg=0xaf3a428c, rdata=0xb18c7e3c) at ../src/pjsip/sip_dialog.c:1660
        status = 0
        tsx = 0xb6684ec4
        processed = 0
        i = 1
{noformat}
Thread 53 is then waiting on the transport, which is held by thread 177.

This deadlock happens because the SIP transport being used is TCP and a message on a SIP dialog is being received at the same time as a message on the same SIP dialog is being sent.  If the transport were UDP the deadlock won't happen.



--
This message was sent by Atlassian JIRA
(v6.2#6252)



More information about the asterisk-bugs mailing list