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

William King william.king at quentustech.com
Wed May 14 20:38:31 MSD 2014


Alex,

Does there happen to be a syntax error in the lua callback? There was a
crash fixed recently(last few months) that dealt with lua not being able
to properly handle an error in a function callback.

William King
Senior Engineer
Quentus Technologies, INC
1037 NE 65th St Suite 273
Seattle, WA 98115
Main:   (877) 211-9337
Office: (206) 388-4772
Cell:   (253) 686-5518
william.king at quentustech.com

On 05/14/2014 09:17 AM, Alex Lake 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
> 



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