[asterisk-bugs] [JIRA] (ASTERISK-23070) Memory leak when using CLI through AMI

Denis (JIRA) noreply at issues.asterisk.org
Thu Jan 2 05:39:03 CST 2014


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

Denis commented on ASTERISK-23070:
----------------------------------

manager conf in realtime MySQL table:
manager.conf general	enabled	 yes
manager.conf general	port	 5038
manager.conf general	bindaddr 0.0.0.0
manager.conf manager	secret	 xxxxxx
manager.conf manager	deny	 0.0.0.0/0.0.0.0
manager.conf manager	permit	 192.168.1.0/255.255.255.0
manager.conf manager	read	 system,call,command,agent,user,dtmf,reporting,originate,agi,cc,aoc
manager.conf manager	write	 system,call,command,agent,user,dtmf,reporting,originate,agi,cc,aoc
manager.conf manager	eventfilter	Event: Registry
manager.conf manager	eventfilter	Event: PeerStatus
manager.conf manager	eventfilter	Event: Dial
manager.conf manager	eventfilter	Event: DialBegin
manager.conf manager	eventfilter	Event: DialEnd
manager.conf manager	eventfilter	Event: Newstate
manager.conf manager	eventfilter	Event: NewCallerid
manager.conf manager	eventfilter	Event: Newchannel
manager.conf manager	eventfilter	Event: PresenceStatus
manager.conf manager	eventfilter	Event: Hangup

In short on base of above mentioned Astxx, i have compiled .dll for third party windows application 1C, I also tried compile the same .dll on pure WinSock2 in both cases memory leak presents. Active using AMI with 4 clients, increase RAM buffer for ~3 hours from ~8400 kb to ~20000 kb, below you can see details:

system booted
[root at localhost ~]# free
             total       used       free     shared    buffers     cached
Mem:       1030584     166060     864524          0       8384      89516

then registered trunk, registered peer, connect and login AMI manager, and now we have

Mem:       1030584     166372     864212          0       8444      89616

it's OK, and now trying to send CLI over AMI

sent CLI command: core show settings

recived:

PBX Core settings
-----------------
  Version:                     12.0.0
  Build Options:               LOADABLE_MODULES, BUILD_NATIVE, OPTIONAL_API
  Maximum calls:               Not set
  Maximum open file handles:   Not set
  Verbosity:                   3
  Debug level:                 0
  Maximum load average:        0.000000
  Minimum free memory:         0 MB
  Startup time:                16:45:52
  Last reload time:            16:45:52
  System:                      Linux/2.6.32-431.1.2.0.1.el6.i686 built by root on i686 2013-12-31 08:53:35 UTC
  System name:                 
  Entity ID:                   08:00:27:15:3e:e7
  Default language:            en
  Language prefix:             Enabled
  User name and group:         /
  Executable includes:         Disabled
  Transcode via SLIN:          Enabled
  Internal timing:             Enabled
  Transmit silence during rec: Disabled
  Generic PLC:                 Enabled
  Min DTMF duration::          80

* Subsystems
  -------------
  Manager (AMI):               Enabled
  Web Manager (AMI/HTTP):      Disabled
  Call data records:           Disabled
  Realtime Architecture (ARA): Enabled

* Directories
  -------------
  Configuration file:          
  Configuration directory:     /etc/asterisk
  Module directory:            /usr/lib/asterisk/modules
  Spool directory:             /var/spool/asterisk
  Log directory:               /var/log/asterisk
  Run/Sockets directory:       /var/run/asterisk
  PID file:                    /var/run/asterisk/asterisk.pid
  VarLib directory:            /var/lib/asterisk
  Data directory:              /var/lib/asterisk
  ASTDB:                       /var/lib/asterisk/astdb
  IAX2 Keys directory:         /var/lib/asterisk/keys
  AGI Scripts directory:       /var/lib/asterisk/agi-bin

now memory state
             total       used       free     shared    buffers     cached
Mem:       1030584     166400     864184          0       8452      89616

repeat this exercise 5 times over ~3 sec. pause, now memory state
             total       used       free     shared    buffers     cached
Mem:       1030584     166536     864048          0       8500      89652

logoff and disconnect AMI manager for 10 minutes... 
...now connect and login AMI manager

now memory state
             total       used       free     shared    buffers     cached
Mem:       1030584     167032     863552          0       8564      89684

10 minutes do nothing...
...10 minutes have passed, during which nothing happens but we recieved several event messages:

Event: Registry
ChannelType: SIP
Domain: qwerty.cnt.ru
Privilege: system,all
Status: Registered
Username: xxxxxxxxxx


Event: PeerStatus
Address: 192.168.1.25:5065
ChannelType: SIP
Peer: SIP/101
PeerStatus: Registered
Privilege: system,all


Event: Registry
ChannelType: SIP
Domain: qwerty.cnt.ru
Privilege: system,all
Status: Registered
Username: xxxxxxxxxx


Event: Registry
ChannelType: SIP
Domain: qwerty.cnt.ru
Privilege: system,all
Status: Registered
Username: xxxxxxxxxx


Event: Registry
ChannelType: SIP
Domain: qwerty.cnt.ru
Privilege: system,all
Status: Registered
Username: xxxxxxxxxx


Event: PeerStatus
Address: 192.168.1.25:5065
ChannelType: SIP
Peer: SIP/101
PeerStatus: Registered
Privilege: system,all

now memory state
             total       used       free     shared    buffers     cached
Mem:       1030584     167032     863552          0       8596      89684

as we see recieving messages over AMI also inrease RAM buffer

now sent CLI command: sip show peers

recived:
Name/username             Host                                    Dyn Forcerport Comedia    ACL Port     Status      Description                      Realtime
101/101                   192.168.1.25                             D  No         Yes         A  5065     Unmonitored                                  Cached RT
1 sip peers [Monitored: 0 online, 0 offline Unmonitored: 1 online, 0 offline]

now memory state
             total       used       free     shared    buffers     cached
Mem:       1030584     167032     863552          0       8604      89684

repeat this exercise 5 times over ~3 sec. pause, now memory state
             total       used       free     shared    buffers     cached
Mem:       1030584     167032     863552          0       8644      89684


                
> Memory leak when using CLI through AMI
> --------------------------------------
>
>                 Key: ASTERISK-23070
>                 URL: https://issues.asterisk.org/jira/browse/ASTERISK-23070
>             Project: Asterisk
>          Issue Type: Bug
>      Security Level: None
>          Components: Core/ManagerInterface
>    Affects Versions: 12.0.0
>         Environment: Centos 6.5 on Oracle VM VirtualBox
>            Reporter: Denis
>            Assignee: Denis
>            Severity: Critical
>
> Calling CLI commands through AMI interface causes memory leak (sending AMI actions does not cause leak), each call CLI command through AMI increase RAM buffer by 8 kb. I am using Astxx lib (by Matthew A. Nicholson http://matt-land.com/astxx/) as AMI caller, memory usage increases when executed 
> action::command command(str_cmd);
> command(*connectionn);

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.asterisk.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira



More information about the asterisk-bugs mailing list