bug report: tight retry loop in mod_ua_on_rx_request

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

 



In mod_ua_on_rx_request in sip_ua_layer.c, I'm seeing the "goto retry_on_deadlock" cause a tight loop that consumes a lot of CPU for a while while answering calls.? This loop seems to be in there to prevent deadlocks when attempting to acquire both the mod_ua mutex and the dialog mutex.

I think the lock conflict happens when an ACK to an INVITE response arrives before pjsua_call_answer has returned.? pjsua_call_answer can cause the program's on_call_state callback to get called one or two times, and the dialog mutex is held the entire time.? So the goto loop fights for CPU with the on_call_state along with the rest of pjsip.? This makes the on_call_state callbacks take even longer.? Note, though, that the goto can run many times even without a slow(ish) on_call_state.


Based on comments in the code, I think that it was probably not expected that this goto loop can run dozens of times, but that's what I'm seeing.

Anyway, I propose that the pj_thread_sleep(0), which is used to yield right before the goto, should be changed to pj_thread_sleep(5) or (10).

There seems to be a similar loop in mod_ua_on_rx_response; I don't know if the fast loop happens there, but a few milliseconds of sleep probably makes sense there as well.


-m@
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/attachments/20120202/6d9e347f/attachment.html>


[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