[asterisk-bugs] [Asterisk 0018924]: [patch] uncached realtime peers are put in peers_by_ip => memory leak

Asterisk Bug Tracker noreply at bugs.digium.com
Tue Mar 8 12:46:34 CST 2011


The following issue has been set as RELATED TO issue 0017255. 
====================================================================== 
https://issues.asterisk.org/view.php?id=18924 
====================================================================== 
Reported By:                wdoekes
Assigned To:                
====================================================================== 
Project:                    Asterisk
Issue ID:                   18924
Category:                   Channels/chan_sip/General
Reproducibility:            always
Severity:                   major
Priority:                   normal
Status:                     new
Asterisk Version:           1.6.2.17 
JIRA:                        
Regression:                 No 
Reviewboard Link:            
SVN Branch (only for SVN checkouts, not tarball releases): N/A 
SVN Revision (number only!):  
Request Review:              
====================================================================== 
Date Submitted:             2011-03-04 01:53 CST
Last Modified:              2011-03-08 12:46 CST
====================================================================== 
Summary:                    [patch] uncached realtime peers are put in
peers_by_ip => memory leak
Description: 
Hi,

I was having problems with UDP leaks at first. This was kindly fixed by
rgagnon with his patch in https://issues.asterisk.org/view.php?id=17255. After
applying that fix, I noticed that
memory usage was *still* increasing.

I've managed to trace the problem to the following:

Peers are put in the peers_by_ip list in parse_register_contact. However,
only if the peer is static or cached(-realtime), does it get a scheduled
expire_register() call. The expire_register makes sure the peer gets
removed from the global 'peers' and 'peers_by_ip' list.

These uncached realtime peers should not be in any of those lists, but
they are in the peers_by_ip list. (Which was hard to see, because the sip
show objects only shows the 'peers' container.)

Furthermore, when asterisk is stopped with 'core stop gracefully', these
peers from these two containers are properly unreferenced: the refcount
utility shows no problem.

But, in the mean time, asterisk has been eating away memory because it
keeps on adding peers to the peers_by_ip list which are never removed.
======================================================================
Relationships       ID      Summary
----------------------------------------------------------------------
related to          0018027 memory leak in chan_sip.c
related to          0017255 [patch] UDP ports not freed/ports leaking
====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2011-03-08 12:46 lmadsen        Relationship added       related to 0017255  
======================================================================




More information about the asterisk-bugs mailing list