[pjsip] Deadlock issue (pjsip 2.1 @4701)
Anshuman S Rawat
arawat at 3clogic.com
Fri May 23 06:14:20 EDT 2014
We have our soft-phone application which uses PJSIP (2.1 @ rev 4701). The
following deadlock was noticed while running. I do not have the complete
stack trace but have a reasonable picture of the stack.
Stack thread 1 (app dials a call):
pj_mutex_lock(mod_ua.mutex) - blocks on this
pjsua_call_make_call() - acquires PJSUA_LOCK()
Stack thread 2 (an incoming call is answered by the app)
pjsua_call_on_state_changed() - blocks on PJSUA_LOCK (acquired by thread 1)
pjsip_tsx_send_msg() - acquires tsx->grp_lock
Stack thread 3 (incoming message on same tsx as in thread 2)
pj_grp_lock_acquire() - blocks on tsx->grp_lock
mod_ua_on_request() - acquires mod_ua.mutex (on which thread 1 is blocked)
Seems like a typical dining philosopher's problem. Has this been
For me, a simple solution seems to be to do a try lock on (mod_ua.mutex)
when been acquired by the UAC (do not want to miss notifications from
network/UAS) and report failure back to application in case it fails.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the pjsip