On Wednesday 21 May 2008 18:32:04 Benny Prijono wrote: > > Well that's the problem in general with SIP, that is we need > cooperation from remote party to achieve things. For example, if we > send CANCEL or BYE, and remote party responds with "Sorry you can't do > that", then what? Should we delete the call or not? In pjsip we chose > the later since it tries to reflect the current state of the session, > rather than what the user intends. > > But that's just a general statement, it's possible that this is a bug > in pjsip instead (make sure you have the latest SVN version in this > case). If you have a logging (at level 5) for your scenario then we > may be able to find a specific solution. > For now i only have my app log and pjsua log level was 1. Well, i will set up log level 5 in a next month when i will start my app again i am sure bug calls will happen again, and then i will send pjsua log and mine to this mail list. > > > > self.lock.acquire() > > try: > > call_info = py_pjsua.call_get_info(self.current_call) > > ... do some stuff > > finally: > > self.lock.release() > > > > So if i isolated every call to py_pjsua.call_get_info > > how can i came with > > pjsua_call.c Timed-out trying to acquire PJSUA mutex (possibly system has deadlocked) in pjsua_call_get_info() > > message in log? > > Well that *exactly* is the problem, isn't it? Imagine two threads are > executing the same piece of code above, one thread comes from pjsip > callback and is holding pjsip mutex and trying to acquire self.lock > mutex, and the other thread is holding self.lock mutex and trying to > acquire pjsip mutex, you end up with deadlock. This is what the past > discussions were all about. > I see. So self.lock only causes deadlock and protects nothing because of underlying mutexes in C. Should i better remove self.lock.acquire() on those chunks of code? I cant get - how should i deal with 2 threads calling pjsua functions, without knowing if there is an mutex acquired in C level? How to avoid deadlock from python? Is there a way to find out if pjsua already acquired lock on mutex (from python level)?