[Freeswitch-users] Lua: io.popen/read blocking in other incoming calls

Dan freeswitch-users at digitaldan.com
Tue Jan 19 15:27:52 PST 2010


One more question, popen on linux forks a new child process to execute a shell in, could the freeswitch environment have any influence on this? 


Thanks 
Dan- 


----- Original Message ----- 
From: "Dan" <freeswitch-users at digitaldan.com> 
To: freeswitch-users at lists.freeswitch.org 
Sent: Tuesday, January 19, 2010 4:14:04 PM 
Subject: Re: [Freeswitch-users] Lua: io.popen/read blocking in other incoming calls 


Thanks for your response, I'm looking through the lua source right now. Am I correct in assuming that each incoming call has its own thread and therefore its own lua vm instance? So the only blocking that would be possible among threads is if they were calling something blocking on the core switch module. That's definitely not happening here, so I'll keep looking around. 




Thanks 
Dan- 
----- Original Message ----- 
From: "Anthony Minessale" <anthony.minessale at gmail.com> 
To: freeswitch-users at lists.freeswitch.org 
Sent: Tuesday, January 19, 2010 3:43:59 PM 
Subject: Re: [Freeswitch-users] Lua: io.popen/read blocking in other incoming calls 

if there is any global lock it would be in the lua lib. I know that would not happen in C so you may want to step it in the debugger and look for any evidence of a global mutex in the lua lib. 



On Tue, Jan 19, 2010 at 3:03 PM, Dan < freeswitch-users at digitaldan.com > wrote: 




My lua script is calling wget through lua's io.popen to send and receive data from a web service. While the f:read to wget is running, other incoming calls will block on the same io.popen call until the first call closes the pipe (with f:close()). 


I had assumed every incoming call was on its own thread and that each had its own lua instance. Is there a global lock happening here? Below is the runCommand call and the two start and stop methods that are getting called in my script when the call begins and ends (notice they even talk to different hosts, so its not the web server hanging). I have put in debugging statements and its definitely hanging trying to call io.popen and not on the f:read. I noticed on the mod_python page ( http://wiki.freeswitch.org/wiki/Mod_python#Known_Bugs ) that it had read issues that were fixed in 12958, could this be related? I'm on svn trunk version 16272 on 32bit debian etch. 


Thanks, 
Dan- 
function runCommand(command)
    local f = io.popen(command) -- runs command
    local l = f:read("*a") -- read output of command
    f:close()
    return l
end function notifyStart(id)
    local url = " http://host1/start?id= " .. id
    
    local wget = "/usr/bin/wget " .. url local out = runCommand(wget) return out; end 
function notifyStop(id)
    local url = " http://host2/start?id= " .. id
    
    local wget = "/usr/bin/wget " .. url local out = runCommand(wget) return out; end 
_______________________________________________ 
FreeSWITCH-users mailing list 
FreeSWITCH-users at lists.freeswitch.org 
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users 
UNSUBSCRIBE: http://lists.freeswitch.org/mailman/options/freeswitch-users 
http://www.freeswitch.org 




-- 
Anthony Minessale II 

FreeSWITCH http://www.freeswitch.org/ 
ClueCon http://www.cluecon.com/ 
Twitter: http://twitter.com/FreeSWITCH_wire 

AIM: anthm 
MSN:anthony_minessale at hotmail.com 
GTALK/JABBER/ PAYPAL:anthony.minessale at gmail.com 
IRC: irc.freenode.net #freeswitch 

FreeSWITCH Developer Conference 
sip:888 at conference.freeswitch.org 
iax:guest at conference.freeswitch.org/888 
googletalk:conf+888 at conference.freeswitch.org 
pstn:+19193869900 

_______________________________________________ 
FreeSWITCH-users mailing list 
FreeSWITCH-users at lists.freeswitch.org 
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users 
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users 
http://www.freeswitch.org 

_______________________________________________ 
FreeSWITCH-users mailing list 
FreeSWITCH-users at lists.freeswitch.org 
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users 
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users 
http://www.freeswitch.org 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20100119/285353ff/attachment-0002.html 


More information about the FreeSWITCH-users mailing list