<html><head><style type='text/css'>p { margin: 0; }</style></head><body><div style='font-family: Times New Roman; font-size: 12pt; color: #000000'>One more question, popen on linux forks a new child process to execute a shell in, could the freeswitch&nbsp;environment&nbsp;have any influence on this?<div><br></div><div>Thanks</div><div>Dan-</div><div><br></div><div>----- Original Message -----<br>From: "Dan" &lt;freeswitch-users@digitaldan.com&gt;<br>To: freeswitch-users@lists.freeswitch.org<br>Sent: Tuesday, January 19, 2010 4:14:04 PM<br>Subject: Re: [Freeswitch-users] Lua: io.popen/read blocking in&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;other&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;incoming calls<br><br><div style="font-family: Times New Roman; font-size: 12pt; color: #000000">Thanks for your response, I'm looking through the lua source right now. &nbsp;Am I correct in assuming that each incoming call has its own thread and therefore its own lua vm instance? &nbsp; So the only blocking that would be possible among threads is if they were calling something blocking on the core switch module. &nbsp;That's&nbsp;definitely&nbsp;not happening here, &nbsp;so I'll keep looking around.<div><div><div><br></div><div>Thanks</div><div>Dan-<br>----- Original Message -----<br>From: "Anthony Minessale" &lt;anthony.minessale@gmail.com&gt;<br>To: freeswitch-users@lists.freeswitch.org<br>Sent: Tuesday, January 19, 2010 3:43:59 PM<br>Subject: Re: [Freeswitch-users] Lua: io.popen/read blocking in other&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;incoming calls<br><br>if there is any global lock it would be in the lua lib.&nbsp; 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.<br><br><br><div class="gmail_quote">
On Tue, Jan 19, 2010 at 3:03 PM, Dan <span dir="ltr">&lt;<a href="mailto:freeswitch-users@digitaldan.com" target="_blank">freeswitch-users@digitaldan.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div><div style="font-family: Times New Roman; font-size: 12pt; color: rgb(0, 0, 0);">My lua script is calling wget through lua's io.popen to send and&nbsp;receive&nbsp;data from a web service. While the f:read to wget &nbsp;is running, other incoming calls will block on the same io.popen call until the first call closes the pipe (with f:close()). &nbsp;<div>
<br></div><div>&nbsp;I had assumed every incoming call was on its own thread and that each had its own lua instance. &nbsp;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). &nbsp;I have put in debugging statements and its&nbsp;definitely&nbsp; hanging &nbsp;trying to call io.popen and not on the f:read. &nbsp;I noticed on the mod_python page &nbsp;(<a href="http://wiki.freeswitch.org/wiki/Mod_python#Known_Bugs" target="_blank">http://wiki.freeswitch.org/wiki/Mod_python#Known_Bugs</a>) that it had read issues that were fixed in 12958, could this be related? &nbsp;I'm on svn trunk version&nbsp;16272 on 32bit debian etch.<div>
<br></div><div>Thanks,</div><div>Dan-</div><div><pre>function runCommand(command)
    local f = io.popen(command) -- runs command
    local l = f:read("*a") -- read output of command
    f:close()
    return l
end
</pre><pre><pre>function notifyStart(id)
    local url = "<a href="http://host1/start?id=" target="_blank">http://host1/start?id=</a>" .. id
    
    local wget = "/usr/bin/wget " .. url</pre><pre>    local out = runCommand(wget)
</pre><pre>    return out;</pre><pre>end
</pre><pre><br></pre><pre><span style="font-family: 'Times New Roman'; white-space: normal;"><pre><pre>function notifyStop(id)
    local url = "<a href="http://host2/start?id=" target="_blank">http://host2/start?id=</a>" .. id
    
    local wget = "/usr/bin/wget " .. url</pre><pre>    local out = runCommand(wget)
</pre><pre>    return out;</pre><pre>end</pre></pre></span></pre></pre></div></div></div></div><br>_______________________________________________<br>
FreeSWITCH-users mailing list<br>
<a href="mailto:FreeSWITCH-users@lists.freeswitch.org" target="_blank">FreeSWITCH-users@lists.freeswitch.org</a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br>Anthony Minessale II<br><br>FreeSWITCH <a href="http://www.freeswitch.org/" target="_blank">http://www.freeswitch.org/</a><br>ClueCon <a href="http://www.cluecon.com/" target="_blank">http://www.cluecon.com/</a><br>
Twitter: <a href="http://twitter.com/FreeSWITCH_wire" target="_blank">http://twitter.com/FreeSWITCH_wire</a><br><br>AIM: anthm<br><a href="mailto:MSN%3Aanthony_minessale@hotmail.com" target="_blank">MSN:anthony_minessale@hotmail.com</a><br>GTALK/JABBER/<a href="mailto:PAYPAL%3Aanthony.minessale@gmail.com" target="_blank">PAYPAL:anthony.minessale@gmail.com</a><br>
IRC: <a href="http://irc.freenode.net" target="_blank">irc.freenode.net</a> #freeswitch<br><br>FreeSWITCH Developer Conference<br><a href="mailto:sip%3A888@conference.freeswitch.org" target="_blank">sip:888@conference.freeswitch.org</a><br><a href="http://iax:guest@conference.freeswitch.org/888" target="_blank">iax:guest@conference.freeswitch.org/888</a><br>
<a href="mailto:googletalk%3Aconf%2B888@conference.freeswitch.org" target="_blank">googletalk:conf+888@conference.freeswitch.org</a><br>pstn:+19193869900<br>
<br>_______________________________________________<br>FreeSWITCH-users mailing list<br>FreeSWITCH-users@lists.freeswitch.org<br>http://lists.freeswitch.org/mailman/listinfo/freeswitch-users<br>UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users<br>http://www.freeswitch.org<br></div></div></div></div><br>_______________________________________________<br>FreeSWITCH-users mailing list<br>FreeSWITCH-users@lists.freeswitch.org<br>http://lists.freeswitch.org/mailman/listinfo/freeswitch-users<br>UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users<br>http://www.freeswitch.org<br></div></div></body></html>