Changes between Version 1 and Version 2 of PJSUA_Locks


Ignore:
Timestamp:
Feb 13, 2008 7:51:30 PM (16 years ago)
Author:
bennylp
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • PJSUA_Locks

    v1 v2  
    3434 
    3535 
     36== Soft Deadlock == 
    3637 
     38Although hard deadlock (where application just freezes) should never happen when the above guidelines are used, there may be cases when application gets a ''soft deadlock'' state. When this happens, application will not freeze permanently, but rather it will freeze for few seconds while PJSUA-LIB is trying to acquire the locks, and these message may appear in the log: 
     39 
     40  ''Timed-out trying to acquire PJSUA mutex (possibly system has deadlocked) in pjsua_xxx'' 
     41 
     42This could happen for example in the following scenario: 
     43 1. application callback is called 
     44 1. application posts a job to a worker thread, and blocks until it gets result from the worker thread 
     45 1. the worker thread calls some PJSUA-LIB call API 
     46 1. when PJSUA-LIB tries to acquire locks with {{{acquire_call()}}} on behalf of the worker thread, it will fail to get them because the locks are currently being held by the callback thread (in step no 1 above). In this case, rather than ''deadlocking'' permanently, PJSUA-LIB will timeout after it retries acquiring the locks for few seconds, and returns PJ_ETIMEDOUT error to {{{acquire_call()}}} caller. 
     47 
     48This problem is not caused by PJSUA-LIB, and in fact PJSUA-LIB has helped us not to deadlock permanently. 
     49 
     50As for the solution, quoting the famous saying, I'll leave that as an exercise for the reader. ;-) 
     51