<div dir="ltr">Hello all.<div><br></div><div>Just want to tell you that the problem remains even after the patch Daniel add to the latest 4.2.</div><div>I've sent another email yesterday (partially quoted bellow) to the mailing list which was already answered by Juha Heinanen in cc regarding an odd behavior (seems odd to me) i'm seeing.</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div style="font-size:12.7272720336914px">I've been testing presence module for a while and I do notice that presentity table grows endlessly over time.</div><div style="font-size:12.7272720336914px">Each time a call is made a new record is added in presentity with a different etag.</div><div style="font-size:12.7272720336914px">In documentation, namely developers guide we can read this:</div><div style="font-size:12.7272720336914px"><pre style="white-space:pre-wrap;color:rgb(0,0,0);border:1px solid rgb(153,204,204);padding-left:15pt;background-color:rgb(254,254,238)">int etag_not_new;
/*
* 0 - the standard mechanism (allocating new etag
for each Publish)
* 1 - allocating an etag only
for an initial Publish
*/</pre><div><p>How can I tell the presence module in kamailio config to work using the second form of the above?</p></div></div></blockquote><div><br></div><div>I have a small production environment with ~70 extensions and in less than 24H (~20H), the presentity table grew from 0 to about ~2000 records, pua table grew to about ~850 records and kamailio memory usage grew from 600MB to 2GB on a 4G Linux server.<br></div><div>Yesterday Juha said and I'll quote:</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><span style="font-size:12.7272720336914px">presence module does not do anything with calls. it handles publish and</span><br style="font-size:12.7272720336914px"><span style="font-size:12.7272720336914px">subscriber requests and generates notifies.</span><br style="font-size:12.7272720336914px"><br style="font-size:12.7272720336914px"><span style="font-size:12.7272720336914px">when publish is handled, it is the job of the publisher to place correct</span><br style="font-size:12.7272720336914px"><span style="font-size:12.7272720336914px">etag in subsequent refresh publish requests.</span><br style="font-size:12.7272720336914px"><br style="font-size:12.7272720336914px"><span style="font-size:12.7272720336914px">-- juha</span></blockquote><div><br></div><div>Here my publisher is Kamailio itself. Can someone elaborate a bit more on this issue and maybe we can get to bottom of it?</div><div>Thanks.</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 Thu, Jan 15, 2015 at 4:56 PM, 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>
I applied the patch, with some adjustments. Now in master, to be
backported to stable branches soon.<br>
<br>
Cheers,<br>
Daniel<div><div class="h5"><br>
<br>
<div>On 13/01/15 20:16, Nuno Reis wrote:<br>
</div>
<blockquote type="cite">
<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>
<p><font color="#1f497d" face="'Trebuchet MS', sans-serif">--</font></p>
<p><b><span>Nuno
Miguel Reis</span></b><span> | <b>Unified
Communication</b></span><b><span>
Systems</span></b><span><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></span><span></span><span><br>
</span></p>
<span>WAVECOM-Soluções
Rádio, S.A.</span><span><br>
Cacia Park | Rua do Progresso, Lote 15</span><span><br>
3800-639 AVEIRO | Portugal</span><span><br>
T. <a value="+351234919190">+351
309 700 225</a> | F. <a value="+351234919191">+351 234 919 191</a></span><span><br>
</span><b><span><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:part8.00040404.06060707@gmail.com" 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" target="_blank"><img alt="Publicity" src="http://www.wavecom.pt/email_signature/pub.png" border="0" height="71" width="389"></a>
</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><br>
<br>
<div>On 13/01/15 08:35, Kristian F. Høgh wrote:<br>
</div>
</div>
</div>
<blockquote type="cite">
<div>
<div>
<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. <a href="tel:%2B351%20234%20919%20191" value="+351234919191" target="_blank">+351 234 919 191</a></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><font color="#888888">
</font></span></pre>
<span><font color="#888888"> </font></span></blockquote>
<span><font color="#888888"> <br>
<pre cols="72">--
Daniel-Constantin Mierla
<a href="http://twitter.com/#%21/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" target="_blank">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>
</blockquote>
<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>
</div></div></div>
</blockquote></div><br></div>