[Freeswitch-dev] memory leak in freeswitch?

rentmycoder rentmycoder rentmycoder at gmail.com
Fri Oct 12 16:23:29 MSD 2012


Hi guys,

I've found a memory leak, and I need your great help to find why is
this happening...
The situation is simple: I execute a simple bash script using lua
popen function as documented in wiki on an extension from the xml
dialplan...
After 1000 calls the memory usage gets 60Mb and after 10.000 calls, 120mb...
Freeswitch becomes very unresponsive and after a time the sip profiles
stop working...
If I uncomment the popen call in lua, memory leak does not occure...

The lua script:

function shell(c)
   local o, h
   h = assert(io.popen(c,"r"))
   o = h:read("*all")
   h:close()
   return o
end
sesson:answer();
while(session.ready()) {
	local testvar=shell(/opt/test.sh)
	session:sleep(1000);
}
sesson:hangup();



The test.sh script:
!#/bin/bash
echo 12345678901234567890123456789012345678901234567890123456789012345678901234567890

Thats all... Tha script just writes to standard output and the lua
script reads it into a variable...

I would like to use this mechanism to communicate with an external process...
This worked well with asterisk anyway...

Question#1: what is the reason of this memory usage and how to fix it?
Question#2: if not possible, how to communicate with an external
process preferably via TCP?
I've tried lua sockets, but same memory leaking occurred...

Tested on: Freeswitch 1.2.3 on debian6 32bit, x86, 4GbRAM
Stress test environment: another FS instance registers as a user and
start calling target extension with a random (30-60 sec) call
timeout...
Monitors call count and if call count falls below 100, starts new
calls as needed...
So there are always 100 live concurrent incoming calls on the test
system... which maximum length of 1 minute.

Thanks a lot...
John



Join us at ClueCon 2011 Aug 9-11, 2011
More information about the FreeSWITCH-dev mailing list