[Freeswitch-users] FS Crash when Lua's doing an http hit

Michael Jerris mike at jerris.com
Wed May 14 20:33:26 MSD 2014


a crash is always a bug, https://wiki.freeswitch.org/wiki/Reporting_Bugs


On May 14, 2014, at 4:17 PM, Alex Lake <alex at digitalmail.com> wrote:

> Got a script that uses Lua to hit a webserver while in the middle of a 
> call to get instructions on what to do next.
> 
> It usually works very well.
> 
> However, it seems that sometimes (possibly a slow response?) this can 
> cause freeswitch to fall over.
> Any suggestions on ways to deal with this?
> 
> This is FreeSWITCH Version 1.2.15+git~20131210T171529Z~fa43a37a82~64bit 
> (git fa43a37 2013-12-10 17:15:29Z 64bit)
> 
> Thinks: From that version, I'm wondering if an update to latest stable 
> release might be in order!
> 
> But I'll post this anyway...
> 
> I'm using luacurl with the following bit of Lua:
> 
>     c = curl.new()
>     text = {}
>     c:setopt(curl.OPT_URL,cc_url)
>     c:setopt(curl.OPT_USERAGENT, "luacurl-agent/1.0")
>     c:setopt(curl.OPT_HTTPGET, true)
>     c:setopt(curl.OPT_CONNECTTIMEOUT, 1)
>     c:setopt(curl.OPT_TIMEOUT, 1)
>     c:setopt(curl.OPT_ENCODING, "utf8")
>     c:setopt(curl.OPT_WRITEFUNCTION, WriteMemoryCallback)
>     c:perform()
>     c:close()
>     Rsp = table.concat(text,'')
> 
> 
> with....
> 
> function WriteMemoryCallback(userparam,s)
>     if s then
>             text[#text+1] = s
>             return string.len(s)
>     else
>             return 0
>     end
> end
> 
> So any suggestions on further diagnostics that I should post (is there a 
> stacktrace or anything similar available?)
> 
> Or just observations on whether getting Lua to do such tricks is 
> inadvisable and there is a better way!
> 
> _________________________________________________________________________
> Professional FreeSWITCH Consulting Services:
> consulting at freeswitch.org
> http://www.freeswitchsolutions.com
> 
> 
> 
> 
> Official FreeSWITCH Sites
> http://www.freeswitch.org
> http://wiki.freeswitch.org
> http://www.cluecon.com
> 
> 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/20140514/41d580f3/attachment-0001.html 


Join us at ClueCon 2013 Aug 6-8, 2013
More information about the FreeSWITCH-users mailing list