<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<TITLE>Fast lock loop with arm</TITLE>

<META content="MSHTML 6.00.6000.16981" name=GENERATOR></HEAD>
<BODY text=#000000 bgColor=#ffffff>
<DIV><SPAN class=077124915-24032010><FONT face=Arial color=#0000ff size=2>I use 
openser 1.3.4.</FONT></SPAN></DIV>
<DIV><SPAN class=077124915-24032010><FONT face=Arial color=#0000ff size=2>Next 
time that the loop happens&nbsp;I'll try to keep the 
backtrace.</FONT></SPAN></DIV>
<DIV><SPAN class=077124915-24032010><FONT face=Arial color=#0000ff 
size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=077124915-24032010><FONT face=Arial color=#0000ff 
size=2>thanks,</FONT></SPAN></DIV>
<DIV><SPAN class=077124915-24032010><FONT face=Arial color=#0000ff 
size=2>Daniele</FONT></SPAN></DIV>
<DIV><SPAN class=077124915-24032010><FONT face=Arial color=#0000ff 
size=2></FONT></SPAN>&nbsp;</DIV>
<BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px">
  <DIV class=OutlookMessageHeader dir=ltr align=left><FONT face=Tahoma 
  size=2>-----Messaggio originale-----<BR><B>Da:</B> Daniel-Constantin Mierla 
  [mailto:miconda@gmail.com]<BR><B>Inviato:</B> mercoledì 24 marzo 2010 
  16.47<BR><B>A:</B> Zappasodi Daniele<BR><B>Cc:</B> users@lists.kamailio.org; 
  sr-dev<BR><B>Oggetto:</B> Re: [Kamailio-Users] Fast lock loop with 
  arm<BR><BR></FONT></DIV>Hello,<BR><BR>what version of kamailio do you 
  use?<BR><BR>Can you grab a backtrace with gdb once you get this high cpu 
  usage? Spot one of the processes, take the pid and do:<BR><BR>gdb&nbsp; 
  /path/to/kamailio&nbsp; _pid_<BR><BR>Then:<BR><BR>bt<BR><BR>You should see the 
  bactrace of executed function getting to deadloc. Make sure you get at least 
  one SIP worker process backtrace (do kamctl ps to see the type of kamailio 
  process).<BR><BR>Cheers,<BR>Daniel<BR><BR>On 3/24/10 4:29 PM, Zappasodi 
  Daniele wrote: 
  <BLOCKQUOTE 
  cite=mid:14A9059A37EF9A45BC2520DE64C30F60075252@slttex002.seltatel.local 
  type="cite">
    <META content="MS Exchange Server version 6.5.7654.12" name=Generator><!-- Converted from text/rtf format -->
    <P><SPAN lang=en-gb><FONT face="Times New Roman">Hi,</FONT></SPAN> <BR><SPAN 
    lang=en-gb><FONT face="Times New Roman">I have a big problem with fast lock 
    mutex on arm CPU: </FONT></SPAN><BR><SPAN lang=en-gb><FONT 
    face="Times New Roman">sometimes I find one or more children that go in an 
    infinite loop, in the while loop of get_lock function. 
    </FONT></SPAN><BR><SPAN lang=en-gb><FONT face="Times New Roman">They remain 
    in Run for long time (sometimes hours) and openser keeps 100% 
    CPU.</FONT></SPAN> </P>
    <P><SPAN lang=en-gb><FONT face="Times New Roman">Now I have changed the 
    functions get_lock and tsl in order to obtain more info and 
    </FONT></SPAN><BR><SPAN lang=en-gb><FONT face="Times New Roman">I observe 
    that&nbsp; (if and) when the process finish the cycle, it have done a big 
    amount of cycles.&nbsp; </FONT></SPAN></P>
    <P><SPAN lang=en-gb><FONT face="Times New Roman">This the log with my added 
    info:</FONT></SPAN> <BR><SPAN lang=en-gb><FONT face="Times New Roman">Mar 26 
    20:29:08 SAM-IP openser[1645]: NOTICE:tm:_lock: ret 1 (cycle)</FONT></SPAN> 
    <BR><SPAN lang=en-gb><FONT face="Times New Roman">Mar 26 20:29:51 SAM-IP 
    openser[1645]: NOTICE:tm:_lock: ret 1 (cycle)</FONT></SPAN> <BR><SPAN 
    lang=en-gb><FONT face="Times New Roman">Mar 26 20:29:55 SAM-IP 
    openser[1645]: NOTICE:tm:_lock: ret 1 (cycle)</FONT></SPAN> </P>
    <P><SPAN lang=en-gb><FONT face="Times New Roman">Mar 26 20:29:55 SAM-IP 
    openser[1645]: NOTICE:tm:t_retransmit_reply: MYTM lock 
    </FONT></SPAN><BR><SPAN lang=en-gb><FONT face="Times New Roman">[process in 
    loop]</FONT></SPAN> <BR><SPAN lang=en-gb><FONT face="Times New Roman">Mar 26 
    20:33:46 SAM-IP openser[1645]: NOTICE:tm:_lock: ret 59374917 
    (cycle)</FONT></SPAN> <BR><SPAN lang=en-gb><FONT 
    face="Times New Roman">[after 4 minutes and 59374917 cycles, this is an 
    example with a "short" loop]</FONT></SPAN> <BR><SPAN lang=en-gb><FONT 
    face="Times New Roman">Mar 26 20:33:46 SAM-IP openser[1645]: 
    NOTICE:tm:t_retransmit_reply: MYTM lock done </FONT></SPAN></P>
    <P><SPAN lang=en-gb><FONT face="Times New Roman">I&#8217;m not able to recognize 
    the call flow that generates the loop (I know only that it always happens 
    when t_retransmit_reply calls LOCK_REPLIES), </FONT></SPAN></P>
    <P><SPAN lang=en-gb><FONT face="Times New Roman">but I urgently need a work 
    around to escape from the loop.</FONT></SPAN> </P>
    <P><SPAN lang=en-gb><FONT face="Times New Roman">This is the get_lock 
    function with my counter j:</FONT></SPAN> </P>
    <P><SPAN lang=en-gb><FONT face="Times New Roman">inline static int 
    get_lock(fl_lock_t* lock)</FONT></SPAN> <BR><SPAN lang=en-gb><FONT 
    face="Times New Roman">{</FONT></SPAN> <BR><SPAN lang=en-gb><FONT 
    face="Times New Roman">#ifdef ADAPTIVE_WAIT</FONT></SPAN> <BR><SPAN 
    lang=en-gb>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT 
    face="Times New Roman">int i=ADAPTIVE_WAIT_LOOPS;</FONT></SPAN> <BR><SPAN 
    lang=en-gb>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT 
    face="Times New Roman">int j=1;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /***** my change 
    ****/</FONT></SPAN> <BR><SPAN lang=en-gb><FONT 
    face="Times New Roman">#endif</FONT></SPAN> <BR><SPAN 
    lang=en-gb>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><BR><SPAN 
    lang=en-gb>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT 
    face="Times New Roman">while(tsl(lock)){</FONT></SPAN> <BR><SPAN 
    lang=en-gb><FONT face="Times New Roman">#ifdef BUSY_WAIT</FONT></SPAN> 
    <BR><SPAN lang=en-gb><FONT face="Times New Roman">#elif defined 
    ADAPTIVE_WAIT</FONT></SPAN> <BR><SPAN 
    lang=en-gb>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT 
    face="Times New Roman">j++;&nbsp;&nbsp;&nbsp; 
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /***** my change 
    ****/</FONT></SPAN> <BR><SPAN 
    lang=en-gb>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT face="Times New Roman">if 
    (i&gt;0) i--;</FONT></SPAN> <BR><SPAN 
    lang=en-gb>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT face="Times New Roman">else 
    sched_yield();</FONT></SPAN> <BR><SPAN lang=en-gb><FONT 
    face="Times New Roman">#else</FONT></SPAN> <BR><SPAN 
    lang=en-gb>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT 
    face="Times New Roman">sched_yield();</FONT></SPAN> <BR><SPAN 
    lang=en-gb><FONT face="Times New Roman">#endif</FONT></SPAN> <BR><SPAN 
    lang=en-gb>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT 
    face="Times New Roman">}</FONT></SPAN> <BR><SPAN 
    lang=en-gb>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT 
    face="Times New Roman">return(j);</FONT></SPAN> <BR><SPAN lang=en-gb><FONT 
    face="Times New Roman">}</FONT></SPAN> </P>
    <P><SPAN lang=en-gb><FONT face="Times New Roman">Can I break the lock when 
    my counter reaches a big value? </FONT></SPAN><BR><SPAN lang=en-gb><FONT 
    face="Times New Roman">Should I call the unlock function after the 
    break?</FONT></SPAN> <BR><SPAN lang=en-gb><FONT face="Times New Roman">which 
    value can be considered too big?</FONT></SPAN> </P>
    <P><SPAN lang=en-gb><FONT face="Times New Roman">Thanks,</FONT></SPAN> 
    <BR><SPAN lang=en-gb><FONT face="Times New Roman">Daniele 
    </FONT></SPAN></P><BR><BR>
    <P>********************************************************************** 
    The information in this message is confidential and may be legally 
    privileged. It is intended solely for the addressee. Access to this message 
    by anyone else is unauthorized. If you are not the intended recipient, any 
    disclosure, copying, or distribution of the message, or any action or 
    omission taken by you in reliance on it, is prohibited and may be unlawful. 
    Please immediately contact the sender if you have received this message in 
    error. 
    **********************************************************************</P><PRE wrap=""><FIELDSET class=mimeAttachmentHeader></FIELDSET>
_______________________________________________
Kamailio (OpenSER) - Users mailing list
<A class=moz-txt-link-abbreviated href="mailto:Users@lists.kamailio.org">Users@lists.kamailio.org</A>
<A class=moz-txt-link-freetext href="http://lists.kamailio.org/cgi-bin/mailman/listinfo/users">http://lists.kamailio.org/cgi-bin/mailman/listinfo/users</A>
<A class=moz-txt-link-freetext href="http://lists.openser-project.org/cgi-bin/mailman/listinfo/users">http://lists.openser-project.org/cgi-bin/mailman/listinfo/users</A></PRE></BLOCKQUOTE><BR>
  <DIV class=moz-signature>-- <BR>Daniel-Constantin Mierla * <A 
  class=moz-txt-link-freetext 
  href="http://www.asipto.com/">http://www.asipto.com/</A> 
</DIV></BLOCKQUOTE><p>**********************************************************************
The information in this message is confidential and may be legally
privileged. It is intended solely for the addressee. Access to this 
message
by anyone else is unauthorized. If you are not the intended 
recipient, any
disclosure, copying, or distribution of the message, or any action 
or
omission taken by you in reliance on it, is prohibited and may be 
unlawful.
Please immediately contact the sender if you have received this 
message in error.


**********************************************************************</p>
</BODY></HTML>