Details

    • Type: Bug Bug
    • Status: Closed
    • Severity: Major Major
    • Resolution: Fixed
    • Affects Version/s: 13.16.0
    • Target Release Version/s: 13.17.0, 14.6.0, 15.0.0
    • Component/s: Resources/res_pjsip
    • Security Level: None
    • Labels:
      None
    • Frequency of Occurrence:
      Occasional

      Description

      Deadlock due to a lock inversion. In the attached back trace you can see that thread 177 is holding a lock on the transport:

      #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
      

      This same thread then requests a lock on the dialog 0xaf3a428c:

      #5  0x08ed4468 in pjsip_dlg_inc_lock (dlg=0xaf3a428c) at ../src/pjsip/sip_dialog.c:847
      

      However the dialog's (0xaf3a428c) lock is being held by thread 53 by the following:

      #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
      

      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.

        Issue Links

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

          Hide
          Richard Mudgett added a comment -

          backtrace.txt - The backtrace only shows the two threads involved in the deadlock.

          Show
          Richard Mudgett added a comment - backtrace.txt - The backtrace only shows the two threads involved in the deadlock.
          Hide
          Ross Beer added a comment -

          Is issue ASTERISK-26686 related?

          Show
          Ross Beer added a comment - Is issue ASTERISK-26686 related?
          Hide
          Richard Mudgett added a comment -

          Ross Beer No. Different locks are involved. The ASTERISK-26686 deadlock appears to involve the transport lock and an Asterisk ao2 container lock. I wasn't able to find the thread holding the transport lock in my brief perusal of the backtrace. The deadlock in this issue involves the transport lock and a call's dialog lock.

          Show
          Richard Mudgett added a comment - Ross Beer No. Different locks are involved. The ASTERISK-26686 deadlock appears to involve the transport lock and an Asterisk ao2 container lock. I wasn't able to find the thread holding the transport lock in my brief perusal of the backtrace. The deadlock in this issue involves the transport lock and a call's dialog lock.

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: