<div dir="ltr">Hi Kristian and Daniel.<div><br></div><div>Kristian, hhanks for you feedback and patch. </div><div>I'll try your patch here and will let you know the outcome soon.</div><div>Thanks again guys.</div><div><br></div><div>Cheers,</div></div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature"><p><font color="#1f497d" face="'Trebuchet MS', sans-serif">--</font></p><p><b><span style="font-size:8.0pt;font-family:"Trebuchet MS","sans-serif";color:#1f497d">Nuno Miguel Reis</span></b><span style="font-size:8.0pt;font-family:"Trebuchet MS","sans-serif";color:#133770"> | <b>Unified Communication</b></span><b><span style="font-size:8.0pt;font-family:"Trebuchet MS","sans-serif";color:#1f497d"> Systems</span></b><span style="font-size:8.0pt;font-family:"Trebuchet MS","sans-serif";color:#133770"><br>
M. <a value="+351918919465">+351 913907481</a> | <a href="mailto:nreis@wavecom.pt" target="_blank"><span style="color:blue">nreis@wavecom.pt</span></a></span><span style="font-size:8.0pt;font-family:"Trebuchet MS","sans-serif""></span><span style="font-size:10.0pt;font-family:"Trebuchet MS","sans-serif";color:#1f497d"></span><span style="font-size:8.0pt;font-family:"Trebuchet MS","sans-serif";color:#133770"><br></span></p><span style="font-size:8.0pt;font-family:"Trebuchet MS","sans-serif";color:#133770">WAVECOM-Soluções Rádio, S.A.</span><span style="font-size:8.0pt;font-family:"Trebuchet MS","sans-serif";color:#133770"><br>
Cacia Park | Rua do Progresso, Lote 15</span><span style="font-size:8.0pt;font-family:"Trebuchet MS","sans-serif";color:#133770"><br>3800-639 AVEIRO | Portugal</span><span style="font-size:8pt;font-family:"Trebuchet MS","sans-serif";color:rgb(19,55,112)"><br>
T. <a value="+351234919190">+351 309 700 225</a> | F. <a value="+351234919191">+351 234 919 191</a></span><span style="font-size:8pt;font-family:"Trebuchet MS","sans-serif";color:rgb(19,55,112)"><br></span><b><span style="font-size:9.0pt;font-family:"Trebuchet MS","sans-serif";color:#1f497d"><a href="http://maps.google.com/maps/ms?msa=0&msid=202333747613191340808.0004b4b227a6144f0df88" target="_blank"><span style="color:#1f497d">GPS</span></a> | <a href="http://www.wavecom.pt/" target="_blank"><span style="color:#1f497d">www.wavecom.pt</span></a></span></b><b><a href="http://www.wavecom.pt/" target="_blank"><span style="color:#1f497d"></span></a></b><p><span style="border-collapse:collapse"></span></p><p><a href="http://www.wavecom.pt/pt/wavecom/premios.php" style="color:rgb(17,85,204)" target="_blank"><span style="text-decoration:none"><img src="cid:image001.png@01CD4A22.D45EAB90" alt="Description: Description: WavecomSignature" border="0" height="100" width="400"></span></a><span style="color:rgb(31,73,125)"></span></p>

<p><a href="http://www.wavecom.pt/pt/mail_eventos.php" style="color:rgb(17,85,204);font-size:medium;font-family:'Times New Roman'" target="_blank"><img alt="Publicity" src="http://www.wavecom.pt/email_signature/pub.png" border="0" height="71" width="389"></a>
</p><p></p><p><span><br></span></p></div></div>
<br><div class="gmail_quote">On Tue, Jan 13, 2015 at 10:00 AM, Daniel-Constantin Mierla <span dir="ltr"><<a href="mailto:miconda@gmail.com" target="_blank">miconda@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
  
    
  
  <div bgcolor="#FFFFFF" text="#000000">
    Hello,<br>
    <br>
    thanks for the details and patch. I will try to look at later today.<br>
    <br>
    Cheers,<br>
    Daniel<div><div class="h5"><br>
    <br>
    <div>On 13/01/15 08:35, Kristian F. Høgh
      wrote:<br>
    </div>
    </div></div><blockquote type="cite"><div><div class="h5">
      
      
      <p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">Hi,</p>
      <p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px"> </p>
      <p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">I've been hunting a memory error in publish
        handling the last couple of days.</p>
      <p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">The error is on our old but good 3.1.x
        presence server.</p>
      <p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">Using memory debug, I located the memory leak
        in modules/presence/hash.c, function insert_phtable, line 492
        (in trunk):</p>
      <p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">p= (pres_entry_t*)shm_malloc(size);</p>
      <p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px"> </p>
      <p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">As far I can see there are two errors when
        deleting publish htable entries</p>
      <p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">1. When calling delete_phtable
        pres.event->type is used instead of
        pres.event->evp->type</p>
      <p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px"> </p>
      <p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">2. When creating publish hashtable,
        p->publ_count is not set. (defaults to 0)</p>
      <p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">In delete_phtable, the following code is
        present</p>
      <p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px"> p->publ_count--;</p>
      <p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px"> if(p->publ_count== 0)</p>
      <p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">p->publ_count is probably decremented to
        -1 (unless the user have two active dialogs)</p>
      <p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px"> </p>
      <p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">I attach a patch, which I would carefully
        test in a test environment :-)</p>
      <p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px"> </p>
      <p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">Regards,</p>
      <p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">Kristian Høgh</p>
      <p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">Uni-tel</p>
      <p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px"> </p>
      <p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px"> </p>
      <p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">On Monday 12 January 2015 15:39:27 Nuno Reis
        wrote:</p>
      <p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">> Hello all.</p>
      <p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">> </p>
      <p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">> I'm consistently watching a memory
        increase in kamailio when dealing with</p>
      <p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">> PRESENCE events, namely SIP PUBLISH
        events. The system eventually hangs</p>
      <p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">> running out of memory.</p>
      <p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">> This behavior is seen at least in
        kamailio 4.1 and 4.2. I'm currently using</p>
      <p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">> the latest stable 4.2.2.</p>
      <p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">> If I disable the SIP PUBLISH handling in
        kamailio i don't observe the issue</p>
      <p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">> anymore but as a side effect I don't
        have presence (name BLFs) also.</p>
      <p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">> What do you think can be the right
        approach here? Should I open an issue in</p>
      <p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">> github for this? Should I run kamailio
        under valgrind for some time? Are</p>
      <p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">> there any other possible debug hints
        here?</p>
      <p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">> Please find attached a code snippet with
        the presence related parts I'm</p>
      <p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">> using right now.</p>
      <p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">> Looking forward to hear from you.</p>
      <p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">> </p>
      <p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">> Best Regards,</p>
      <p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">> </p>
      <p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">> --</p>
      <p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">> </p>
      <p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">> *Nuno Miguel Reis* | *Unified
        Communication** Systems*</p>
      <p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">> M. <a href="tel:%2B351%20913907481" value="+351913907481" target="_blank">+351 913907481</a> | <a href="mailto:nreis@wavecom.pt" target="_blank">nreis@wavecom.pt</a></p>
      <p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">> WAVECOM-Soluções Rádio, S.A.</p>
      <p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">> Cacia Park | Rua do Progresso, Lote 15</p>
      <p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">> 3800-639 AVEIRO | Portugal</p>
      <p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">> T. <a href="tel:%2B351%20309%20700%20225" value="+351309700225" target="_blank">+351 309 700 225</a> | F. +351 234 919
        191</p>
      <p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">> *GPS</p>
      <p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">>
<a href="http://maps.google.com/maps/ms?msa=0&msid=202333747613191340808.0004b4b227a6144f0df88" target="_blank"><http://maps.google.com/maps/ms?msa=0&msid=202333747613191340808.0004b4b227a6144f0df88></a></p>
      <p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">> | <a href="http://www.wavecom.pt" target="_blank">www.wavecom.pt</a>
        <a href="http://www.wavecom.pt/" target="_blank"><http://www.wavecom.pt/></a>** <a href="http://www.wavecom.pt/" target="_blank"><http://www.wavecom.pt/></a>*</p>
      <p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">> </p>
      <p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">> [image: Description: Description:
        WavecomSignature]</p>
      <p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">>
        <a href="http://www.wavecom.pt/pt/wavecom/premios.php" target="_blank"><http://www.wavecom.pt/pt/wavecom/premios.php></a></p>
      <p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">> </p>
      <p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">> [image: Publicity]
        <a href="http://www.wavecom.pt/pt/mail_eventos.php" target="_blank"><http://www.wavecom.pt/pt/mail_eventos.php></a></p>
      <p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px"> </p>
      <br>
      <fieldset></fieldset>
      <br>
      </div></div><pre>_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
<a href="mailto:sr-users@lists.sip-router.org" target="_blank">sr-users@lists.sip-router.org</a>
<a href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users" target="_blank">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users</a><span class="HOEnZb"><font color="#888888">
</font></span></pre><span class="HOEnZb"><font color="#888888">
    </font></span></blockquote><span class="HOEnZb"><font color="#888888">
    <br>
    <pre cols="72">-- 
Daniel-Constantin Mierla
<a href="http://twitter.com/#!/miconda" target="_blank">http://twitter.com/#!/miconda</a> - <a href="http://www.linkedin.com/in/miconda" target="_blank">http://www.linkedin.com/in/miconda</a></pre>
  </font></span></div>

<br>_______________________________________________<br>
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list<br>
<a href="mailto:sr-users@lists.sip-router.org">sr-users@lists.sip-router.org</a><br>
<a href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users" target="_blank">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users</a><br>
<br></blockquote></div><br></div>