]> git.ipfire.org Git - thirdparty/asterisk.git/commit
res_pjsip: Fix deadlock on reliable transport shutdown.
authorRichard Mudgett <rmudgett@digium.com>
Thu, 29 Mar 2018 22:07:56 +0000 (17:07 -0500)
committerRichard Mudgett <rmudgett@digium.com>
Thu, 29 Mar 2018 22:21:16 +0000 (17:21 -0500)
commitf044ae1804760dfc2a6d18db47793659b83103e0
tree7ac8d4c8bbb1bcc62d986ffbb1af6a7bdb0000d5
parent4773b3bd78cff762d86739cd85f1f16d06a7bfed
res_pjsip: Fix deadlock on reliable transport shutdown.

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.

* res_pjsip_pubsub.c: Avoid the deadlock by pushing the subscription
removal to the subscription serializer.

* res_pjsip_registrar.c: Pushed off incoming registration contact removals
to a default serializer as a precaution.  Removing the contacts involves
sorcery access which in this case will involve database access.  Depending
upon the setup, the database may not be on the same machine and could take
awhile.  We don't want to hold up the pjsip monitor thread with
potentially long access times.

ASTERISK-27706

Change-Id: I56b647aea565f24dba33e9e5ebeed4cd3f31f8c4
res/res_pjsip_outbound_registration.c
res/res_pjsip_pubsub.c
res/res_pjsip_registrar.c