[PJSIP 1.1] deadlock on high call volume

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi David,

when you say you're not in a call back function, you mean the pjsua_*
calls you are making are not done from a PJSIP callback function?  Or
you mean the deadlock is not in a callback function?

I'm not using PJSUA.  I'm using the lower level APIs, but I ran into a
deadlock issue that would also be an issue for PJSUA.  The problem was
interaction between my locking mechanism and PJSIPs.  I had locks on
resources that I acquire when working on the resource.  When the
resource would call some PJSIP functions, an internal lock was
acquired (one I wasn't aware of at the time).  That same internal lock
is acquired in some cases before my callbacks are called.

I had a case where one thread had my application layer resource lock
and called a PJSIP function which acquired the dialog lock.  On
another thread (a PJSIP thread) the dialog lock had already been
acquired and that thread was calling one of my callbacks.  My callback
was trying to acquire my application layer lock.  Boom.  Deadlock.

Now I always acquire the PJSIP dialog lock before trying to acquire my
application layer resource lock.

Hope this helps.

Joel

On Fri, Jun 19, 2009 at 11:48 AM, David Clark<vdc1048 at tx.rr.com> wrote:
> Yea even with 1.2 I still have pjsua_call_hangup() and pjsua_call_get_info()
> returning 70009 after like a 3 minute delay.
> I am back to a mutex debug enabled hammer test.? Anybody have any ideas?
> The pjsua_call_hangup() and pjsua_call_get_info()
> are not in a callback function.? The pjsua_call_get_info() is after a
> make_call and is optional.? I am only doing it to get the call_id string
> the sip provider sends for tracking.? Or in this case pjsip makes up.
>
> David Clark
>
>
> At 11:35 PM 6/16/2009, Nguyen Van Minh Danh wrote:
>
> Hi David
>
> Thanks for the suggestions. I was doing the playing/recording/conference
> add/remove port inside the on_call_state callback event. After some
> research, I think the issue I mentioned has got to do with this
>
> [pjsip] Infinite loop in jbuf causing deadlock,
> http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/2009-March/006761.html
>
> There was a bug in jbuf.c (v1.1) which resulted in an infinite loop. The
> PJSIP release log shows that the issue has been fixed in PJSIP 1.2. So I
> upgraded to 1.2 (I was using 1.1), did not change my code at all, and the
> issue doesn't seem to appear anymore.
>
> Nevertheless, you have a valid point that a deadlock may happen when calling
> pjsua_ calls from a PJSIP callback event. Previously I observed deadlocks
> when calling pjsua_call_makecall and pjsua_call_hangup, which could only be
> resolved by calling these APIs from a separate thread but I did not know it
> had to do with the callback event.
>
> As an experiment, I run PJSIP 1.1 with code modified to do the pjsua_ calls
> from a separate thread (and not in the PJSIP callback function) and the
> issue also does not appear again.
>
> Thanks
> _______________________________________________
> Visit our blog: http://blog.pjsip.org
>
> pjsip mailing list
> pjsip at lists.pjsip.org
> http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org
>
> _______________________________________________
> Visit our blog: http://blog.pjsip.org
>
> pjsip mailing list
> pjsip at lists.pjsip.org
> http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org
>
>



[Index of Archives]     [Asterisk Users]     [Asterisk App Development]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [Linux API]
  Powered by Linux