[SR-Users] Possible memory leak dealing with presence in kamailio

Daniel-Constantin Mierla miconda at gmail.com
Thu Jan 15 17:56:30 CET 2015


Hello,

I applied the patch, with some adjustments. Now in master, to be
backported to stable branches soon.

Cheers,
Daniel

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

-- 
Daniel-Constantin Mierla
http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20150115/4f2f231c/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/png
Size: 16423 bytes
Desc: not available
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20150115/4f2f231c/attachment.png>


More information about the sr-users mailing list