[asterisk-bugs] [JIRA] (ASTERISK-27706) PJSIP: Deadlock shutting down subscription TCP connection and sending subscription message.

Richard Mudgett (JIRA) noreply at issues.asterisk.org
Thu Mar 29 13:30:52 CDT 2018


     [ https://issues.asterisk.org/jira/browse/ASTERISK-27706?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Richard Mudgett updated ASTERISK-27706:
---------------------------------------

    Description: 
A deadlock can happen when the PJSIP monitor thread is shutting down a connection oriented transport (TCP/TLS) used by a subscription at the same time as another thread tries to send something for that subscription.  The deadlock is between the pjsip monitor thread attempting to get the dialog lock and another thread sending something for that dialog when it tries to get the transport manager lock.

To verify this deadlock:
* Get a full backtrace of all threads when in deadlock.
* Search for the pjsip monitor thread.  It will be the one executing monitor_thread_exec().
* The monitor thread will be attempting to get the dlg (dialog) lock.
* Search for another thread doing something with the same dlg pointer.  It will be trying to send something.
* That thread will be attempting to get the tpmgr/mgr (transport manager) lock.
* The tpmgr/mgr pointer will be the same as the one being used by the pjsip monitor thread since it is trying to shut that transport down.

  was:
Asterisk deadlocks while running the db_sync_thread:

{noformat}
Thread 1 (Thread 0x7fc2bbc7a700 (LWP 177764)):
#0  0x00007fc2b9396b20 in pthread_cond_wait@@GLIBC_2.3.2 () at /usr/lib64/libpthread.so.0
#1  0x0000000000540f69 in __ast_cond_wait (filename=0x6db50b "db.c", lineno=1037, func=0x6dc768 <__PRETTY_FUNCTION__.16508> "db_sync_thread", cond_name=0x6dc5ab "&dbcond", mutex_name=0x6db865 "&dblock", cond=0x9c5000 <dbcond>, t=0x9a33c0 <dblock>) at lock.c:600
        res = 0
#2  0x00000000004fe765 in db_sync_thread (data=0x0) at db.c:1037
{noformat}

This may be cuased by the check_expiration_thread.


> PJSIP: Deadlock shutting down subscription TCP connection and sending subscription message.
> -------------------------------------------------------------------------------------------
>
>                 Key: ASTERISK-27706
>                 URL: https://issues.asterisk.org/jira/browse/ASTERISK-27706
>             Project: Asterisk
>          Issue Type: Bug
>      Security Level: None
>          Components: Core/AstDB
>    Affects Versions: 13.19.2, GIT
>         Environment: Fedora 23
>            Reporter: Ross Beer
>              Labels: pjsip
>         Attachments: core.174244-thread1.txt, core.6829-thread1.txt, Thread_103.txt
>
>
> A deadlock can happen when the PJSIP monitor thread is shutting down a connection oriented transport (TCP/TLS) used by a subscription at the same time as another thread tries to send something for that subscription.  The deadlock is between the pjsip monitor thread attempting to get the dialog lock and another thread sending something for that dialog when it tries to get the transport manager lock.
> To verify this deadlock:
> * Get a full backtrace of all threads when in deadlock.
> * Search for the pjsip monitor thread.  It will be the one executing monitor_thread_exec().
> * The monitor thread will be attempting to get the dlg (dialog) lock.
> * Search for another thread doing something with the same dlg pointer.  It will be trying to send something.
> * That thread will be attempting to get the tpmgr/mgr (transport manager) lock.
> * The tpmgr/mgr pointer will be the same as the one being used by the pjsip monitor thread since it is trying to shut that transport down.



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



More information about the asterisk-bugs mailing list