[asterisk-bugs] [JIRA] (ASTERISK-22945) [patch] Memory leak in chan_sip.c with realtime autoclear

dominic paquette (JIRA) noreply at issues.asterisk.org
Mon Sep 22 08:13:29 CDT 2014


    [ https://issues.asterisk.org/jira/browse/ASTERISK-22945?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=222732#comment-222732 ] 

dominic paquette commented on ASTERISK-22945:
---------------------------------------------

Ibercom: I found my main leak last friday and ran it in prod through the week end, looks like my main memory leak was comming from one of our custom patches. I just ran the fixed version through valgrind, and, Ièm probably seeing the same leak you have (before I had to restart my server daily, and now, looking at my mem usage graphs I probably will have to restart every 2 weeks or so). I see this in valgrind:
==18320== 20,628,228 (14,412,096 direct, 6,216,132 indirect) bytes in 786 blocks are definitely lost in loss record 2,159 of 2,159
==18320==    at 0x4C2AAE8: calloc (vg_replace_malloc.c:618)
==18320==    by 0x5A3A66: _ast_calloc (utils.h:514)
==18320==    by 0x44EA71: internal_ao2_alloc (astobj2.c:565)
==18320==    by 0x44ECC3: __ao2_alloc (astobj2.c:641)
==18320==    by 0xC09E81C: build_peer (chan_sip.c:30673)
==18320==    by 0xC017A1D: realtime_peer (chan_sip.c:5434)
==18320==    by 0xC018058: sip_find_peer_full (chan_sip.c:5529)
==18320==    by 0xC01814F: sip_find_peer (chan_sip.c:5568)
==18320==    by 0xC05290B: register_verify (chan_sip.c:16880)
==18320==    by 0xC090423: handle_request_register (chan_sip.c:28128)
==18320==    by 0xC091C62: handle_incoming (chan_sip.c:28436)
==18320==    by 0xC09262F: handle_request_do (chan_sip.c:28604)

I ran a sipp script that does a bunch of registrations (also does subscribes, which was where my custom patch was leaking). I can reproduce at will, on an asterisk running in valgrind. I'll keep you posted if I find anything.


> [patch] Memory leak in chan_sip.c with realtime autoclear
> ---------------------------------------------------------
>
>                 Key: ASTERISK-22945
>                 URL: https://issues.asterisk.org/jira/browse/ASTERISK-22945
>             Project: Asterisk
>          Issue Type: Bug
>      Security Level: None
>          Components: Channels/chan_sip/General
>    Affects Versions: 11.6.0
>            Reporter: ibercom
>         Attachments: asterisk11-chan_sip-simplifies.patch, asterisk11.patch, cli-command.txt, memory-allocations.gz
>
>
> I have 2 servers with SIP realtime config and asterisk 1.8 and 11 each one.
> Server 1.8 have about 2000 register peers without obvious problems.
> Server 11 have about 20 register peers and chan_sip.c is constantly leaking memory with each call to the other peers.
> The SIP realtime config is the same:
> rtcachefriends=yes
> rtsavesysname=yes
> rtupdate=yes
> rtautoclear=yes		<< I think than here is the problem
> ignoreregexpire=yes
> When Server 11 look for some peer (not register peer) in sippeers table, it works with this info. Another (+1) static (realtime?) object. When the registration expires, memory leak. You can look for the same peer after some time and asterisk allocates memory again and it isn't freed.
> I have attached cli-command.txt which shows the asterisk's state with only 112 calls processed.



--
This message was sent by Atlassian JIRA
(v6.2#6252)



More information about the asterisk-bugs mailing list