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

ibercom (JIRA) noreply at issues.asterisk.org
Fri Apr 25 13:12:19 CDT 2014


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

ibercom edited comment on ASTERISK-22945 at 4/25/14 1:11 PM:
-------------------------------------------------------------

I have managed detect a reference leak related to realtime peers in chan_sip.

{noformat}
        /* Startup regular pokes */
        if (!devstate_only && realtime && peer->lastms > 0) {
-               sip_ref_peer(peer, "schedule qualify");
+               /* sip_ref_peer(peer, "schedule qualify"); */
                sip_poke_peer(peer, 0);
        }
{noformat}

If I comment this line of code, rtautoclear works ok. sip show objects shows correct counters and destructor function for these peers (objects) is called.

But I don't know exactly the functionality of it. Although this works.



was (Author: ibercom):
I have managed detect a reference leak related to realtime peers in chan_sip.

{noformat}
        /* Startup regular pokes */
        if (!devstate_only && realtime && peer->lastms > 0) {
-               /* sip_ref_peer(peer, "schedule qualify"); */
+               sip_ref_peer(peer, "schedule qualify");
                sip_poke_peer(peer, 0);
        }
{noformat}

If I comment this line of code, rtautoclear works ok. sip show objects shows correct counters and destructor function for these peers (objects) is called.

But I don't know exactly the functionality of it. Although this works.


> [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.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