]> git.ipfire.org Git - thirdparty/asterisk.git/commit
res_pjsip_registrar: mitigate blocked threads on reliable transport shutdown
authorKevin Harwell <kharwell@digium.com>
Tue, 22 Jan 2019 17:48:41 +0000 (11:48 -0600)
committerKevin Harwell <kharwell@digium.com>
Tue, 22 Jan 2019 19:16:25 +0000 (13:16 -0600)
commit2e1cbcde7dfe42e2876502dccade013f3b67f178
tree9555a30c9916719bb4568702febe125ad573e262
parente66d4d1d2ae56303f7e5dbebdd954b49c3ec7d7c
res_pjsip_registrar: mitigate blocked threads on reliable transport shutdown

When a reliable transport is shutdown it's possible for the pjsip registrar
resource shutdown handler to get called multiple times. If this happens and one
of the threads is taking "too long" (slow database call for instance) then the
others get blocked waiting to delete.

Since it only takes one to delete the contact then the other threads should be
able to continue on if one of the threads is currently "deleting". This patch
makes it so now when a thread enters the shutdown handler it checks to see if a
thread is currently already "deleting". If so, then the thread does not attempt
to get the lock, and instead continues on thus avoiding the blockage.

ASTERISK-28213 #close

Change-Id: I7563ca596312b1dff4f3ab41483e89fe2862328a
res/res_pjsip_registrar.c