res_pjsip: Move URI validation to use time.
authorJoshua Colp <jcolp@digium.com>
Wed, 21 Oct 2015 16:44:17 +0000 (13:44 -0300)
committerJoshua Colp <jcolp@digium.com>
Wed, 21 Oct 2015 17:36:06 +0000 (12:36 -0500)
commit64c172debadfb6c5d6d4e424fdefd8ad86268b3b
tree63db46984f1bd15ed59debab07973c9ed0f1f42a
parentb9bd249a85b7dcb3890fca1df8cf12558f7d82f5
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
res/res_pjsip.c
res/res_pjsip/location.c
res/res_pjsip/pjsip_configuration.c