From f2725c8b77f6e6d6b70c12c4e57e26083530c3be Mon Sep 17 00:00:00 2001 From: Joshua Colp Date: Wed, 21 Oct 2015 13:44:17 -0300 Subject: res_pjsip: Move URI validation to use time. In a realtime based system with a limited number of threadpool threads it is possible for a deadlock to occur. This happens when permanent endpoint state is updated, which will cause database queries to be done. These queries may result in URI validation being done which is done synchronously using a PJSIP thread. If all PJSIP threads are in use processing traffic they themselves may be blocked waiting to get the permanent endpoint container lock when identifying an endpoint. This change moves URI validation to occur at use time instead of configuration time. While this comes at a cost of not seeing a problem until you use it it does solve the underlying deadlock problem. ASTERISK-25486 #close Change-Id: I2d7d167af987d23b3e8199e4a68f3359eba4c76a --- include/asterisk/res_pjsip.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'include/asterisk') diff --git a/include/asterisk/res_pjsip.h b/include/asterisk/res_pjsip.h index a36935dd3..459082901 100644 --- a/include/asterisk/res_pjsip.h +++ b/include/asterisk/res_pjsip.h @@ -1190,6 +1190,11 @@ int ast_sip_push_task(struct ast_taskprocessor *serializer, int (*sip_task)(void * cause a deadlock. If you are in a SIP servant thread, just call your function * in-line. * + * \warning \b Never hold locks that may be acquired by a SIP servant thread when + * calling this function. Doing so may cause a deadlock if all SIP servant threads + * are blocked waiting to acquire the lock while the thread holding the lock is + * waiting for a free SIP servant thread. + * * \param serializer The SIP serializer to which the task belongs. May be NULL. * \param sip_task The task to execute * \param task_data The parameter to pass to the task when it executes -- cgit v1.2.3