[Home]

Summary:ASTERISK-06476: memleak in chan_sip
Reporter:Roy Sigurd Karlsbakk (rkarlsba)Labels:
Date Opened:2006-03-05 09:16:41.000-0600Date Closed:2011-06-07 14:10:15
Priority:MinorRegression?No
Status:Closed/CompleteComponents:Core/General
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) callgraph.png
( 1) leak.png
( 2) memsummaryandallocations-2006-03-05_16_10_00.txt.gz
Description:there seems to be a rather nasty memory leak in chan_sip. monitoring active sip channels show a constant climb of channels and memory is allocated and not freed. I'm uploading an initial 'show memory summary' and '.. allocations' and will upload another in a few hours. this is 1.2.svn 11715 with the sip jitterbuffer from ASTERISK-3764
Comments:By: Roy Sigurd Karlsbakk (rkarlsba) 2006-03-05 12:10:04.000-0600

also, as stated in ASTERISK-6477, astmm has a bug that crashes asterisk, so debugging this could be easier :{

By: Roy Sigurd Karlsbakk (rkarlsba) 2006-03-05 12:25:29.000-0600

sorry.
this should say Version: SVN and SVN Branch: 1.2

By: Roy Sigurd Karlsbakk (rkarlsba) 2006-03-05 15:34:02.000-0600

after six hours uptime and a few thousand calls, asterisk now uses 600/300 megs of ram (reported by ps). show memory summary shows as follows.

        1 bytes in     1 allocations in file 'res_features.c'
       21 bytes in     1 allocations in file 'cli.c'
       24 bytes in     1 allocations in file 'devicestate.c'
      154 bytes in     2 allocations in file 'config.c'
      192 bytes in     4 allocations in file 'jitterbuf.c'
      224 bytes in     4 allocations in file 'translate.c'
      240 bytes in     2 allocations in file 'netsock.c'
      256 bytes in     1 allocations in file 'iax2-provision.c'
      280 bytes in    10 allocations in file 'res_odbc.c'
      288 bytes in    12 allocations in file 'acl.c'
      520 bytes in     1 allocations in file 'enum.c'
      784 bytes in     2 allocations in file 'res_crypto.c'
     1024 bytes in    64 allocations in file 'res_agi.c'
     1632 bytes in    34 allocations in file 'manager.c'
     2352 bytes in     3 allocations in file 'dsp.c'
     3408 bytes in     6 allocations in file 'app_voicemail.c'
     4216 bytes in    17 allocations in file 'file.c'
     6550 bytes in   168 allocations in file 'asterisk.c'
     7800 bytes in   325 allocations in file 'app_dial.c'
     7905 bytes in   443 allocations in file 'pbx_config.c'
     8846 bytes in   432 allocations in file 'res_indications.c'
     9520 bytes in    14 allocations in file 'chan_agent.c'
    21921 bytes in   406 allocations in file 'logger.c'
    22096 bytes in    35 allocations in file 'chan_iax2.c'
    24688 bytes in    13 allocations in file 'io.c'
    25696 bytes in     2 allocations in file 'codec_alaw.c'
    25912 bytes in     2 allocations in file 'codec_g726.c'
    30233 bytes in   605 allocations in file 'chanvars.c'
    30496 bytes in   114 allocations in file 'app_queue.c'
    40960 bytes in   128 allocations in file 'loader.c'
    61313 bytes in   728 allocations in file 'pbx.c'
    61984 bytes in  1259 allocations in file 'scx_jitterbuf.c'
    69000 bytes in    68 allocations in file 'cdr.c'
   148176 bytes in  2608 allocations in file 'sched.c'
   178703 bytes in   295 allocations in file 'channel.c'
   331040 bytes in     5 allocations in file 'res_musiconhold.c'
  1824228 bytes in   342 allocations in file 'rtp.c'
  2669928 bytes in  3627 allocations in file 'frame.c'
 11350260 bytes in  3859 allocations in file 'chan_sip.c'
16972871 bytes allocated 15643 units total

By: Olle Johansson (oej) 2006-03-06 01:50:13.000-0600

Please test this *without* the jitterbuffer to see if it happens in a plain Asterisk. Thanks.

By: Roy Sigurd Karlsbakk (rkarlsba) 2006-03-06 04:27:40.000-0600

the leak increases as traffic increases... see attached graph

By: Kristian Larsson (kll) 2006-03-06 04:45:45.000-0600

I'm seeing the same thing although I don't have astmm compiled in so I cannot confirm what is actually eating memory my system is leaking away, and the more calls the more memory is wasted.
rkarlsba's asterisk is probably more heavily loaded than mine, I have about 150 users and after a days usage it uses about 100MB RAM. I'm currently at 600MB and will have to restart tonight as strange things may happen when the memory consumption is way up there.

I'm not the programmer type but I can help out in testing patches and or other debugging things.

By: Kristian Larsson (kll) 2006-03-06 04:48:01.000-0600

I'm sorry, forgot to mention that I'm currently running 1.2.4 and I have prepared for an installation of the latest SVN for tonight. I am not using jitterbuffer.

By: Roy Sigurd Karlsbakk (rkarlsba) 2006-03-06 05:07:18.000-0600

take a look at the attached call graph. the blue line is reported active sip channels on the sip/sip gateway. the green area indicates active zap calls from the pstn gateways. these should, as in the end, be equal, but during the leak, the number of sip channels are higher.

By: Olle Johansson (oej) 2006-03-06 08:26:05.000-0600

Error caused by jitterbuffer patch, please continue this discussion in that bug report. Thanks.