[Freeswitch-dev] coredump connecting to ldap database from dialplan within lua
Jyotshna Cherukuri
jcherukuri_necc at yahoo.com
Fri Sep 9 00:59:05 MSD 2011
Hi,
I am having a problem connecting to LDAP database from dialplan using lua script. When I run the below script from xml dialplan it causing a coredump and Freeswitch crashes.
The coredump looks like:
Core was generated by `/usr/local/freeswitch/bin/freeswitch -nonat -nc -heavy-timer'.
Program terminated with signal 11, Segmentation fault.
#0 0x00002aaab6ff1720 in ldap_set_option () from /usr/lib64/libldap-2.3.so.0
(gdb) bt
#0 0x00002aaab6ff1720 in ldap_set_option () from /usr/lib64/libldap-2.3.so.0
#1 0x00002aaab6dbb68a in lualdap_open_simple () from /usr/local/lib/lua/5.1/lualdap.so
#2 0x00002aaab6b91704 in luaD_precall (L=0x14e12740, func=<value optimized out>, nresults=-1) at ldo.c:319
#3 0x00002aaab6b9a4a4 in luaV_execute (L=0x14e12740, nexeccalls=1) at lvm.c:587
#4 0x00002aaab6b91b4e in luaD_call (L=0x14e12740, func=0x14e12b20, nResults=0) at ldo.c:377
#5 0x00002aaab6b912a7 in luaD_rawrunprotected (L=0x14e12740, f=0x2aaab6b8ed40 <f_call>, ud=0x409f4e00) at ldo.c:116
#6 0x00002aaab6b91325 in luaD_pcall (L=0xffffffffb002d5d0, func=0, u=0x2aaab002d5b8, old_top=46912585783072, ef=0) at ldo.c:463
#7 0x00002aaab6b8ebc5 in lua_pcall (L=0x14e12740, nargs=0, nresults=0, errfunc=<value optimized out>) at lapi.c:821
#8 0x00002aaab6b76d61 in docall (L=0x14e12740, narg=0, clear=1, perror=0) at mod_lua.cpp:91
#9 0x00002aaab6b77194 in lua_parse_and_execute (L=0x14e12740, input_code=0x2aaab004c220 "ldapdirectory.lua") at mod_lua.cpp:183
#10 0x00002aaab6b77e92 in lua_function (session=0x14e5bb68, data=<value optimized out>) at mod_lua.cpp:414
#11 0x00002b027ace8cd9 in switch_core_session_exec (session=0x14e5bb68, application_interface=0x2aaaac0622d8, arg=0x14d75968 "ldapdirectory.lua") at src/switch_core_session.c:2048
#12 0x00002b027ace9176 in switch_core_session_execute_application_get_flags (session=0xffffffffb002d5d0, app=0x14d758e8 "lua", arg=0x14d75968 "ldapdirectory.lua", flags=0x0) at src/switch_core_session.c:1962
#13 0x00002b027ad57a1a in CoreSession::execute (this=0x14d74d60, app=0x14d758e8 "lua", data=0x14d75968 "ldapdirectory.lua") at src/switch_cpp.cpp:658
#14 0x00002aaab6b861c0 in _wrap_CoreSession_execute (L=0x2aaaac002050) at mod_lua_wrap.cpp:5678
#15 0x00002aaab6b91704 in luaD_precall (L=0x2aaaac002050, func=<value optimized out>, nresults=0) at ldo.c:319
#16 0x00002aaab6b9a4a4 in luaV_execute (L=0x2aaaac002050, nexeccalls=1) at lvm.c:587
#17 0x00002aaab6b91b4e in luaD_call (L=0x2aaaac002050, func=0x2aaaac012400, nResults=0) at ldo.c:377
#18 0x00002aaab6b912a7 in luaD_rawrunprotected (L=0x2aaaac002050, f=0x2aaab6b8ed40 <f_call>, ud=0x409f5800) at ldo.c:116
#19 0x00002aaab6b91325 in luaD_pcall (L=0xffffffffb002d5d0, func=0, u=0x2aaab002d5b8, old_top=46912585783072, ef=0) at ldo.c:463
#20 0x00002aaab6b8ebc5 in lua_pcall (L=0x2aaaac002050, nargs=0, nresults=0, errfunc=<value optimized out>) at lapi.c:821
#21 0x00002aaab6b76d61 in docall (L=0x2aaaac002050, narg=0, clear=1, perror=0) at mod_lua.cpp:91
#22 0x00002aaab6b77194 in lua_parse_and_execute (L=0x2aaaac002050, input_code=0x14de5e00 "helloworld.lua") at mod_lua.cpp:183
#23 0x00002aaab6b77e92 in lua_function (session=0x14e5bb68, data=<value optimized out>) at mod_lua.cpp:414
#24 0x00002b027ace8cd9 in switch_core_session_exec (session=0x14e5bb68, application_interface=0x2aaaac0622d8, arg=0x14e2f368 "helloworld.lua") at src/switch_core_session.c:2048
#25 0x00002b027ace9176 in switch_core_session_execute_application_get_flags (session=0xffffffffb002d5d0, app=0x14e2f360 "lua", arg=0x14e2f368 "helloworld.lua", flags=0x0) at src/switch_core_session.c:1962
#26 0x00002b027acec4ad in switch_core_session_run (session=0x14e5bb68) at src/switch_core_state_machine.c:176
#27 0x00002b027ace8720 in switch_core_session_thread (thread=<value optimized out>, obj=0x14e5bb68) at src/switch_core_session.c:1271
#28 0x0000003ce900673d in start_thread () from /lib64/libpthread.so.0
#29 0x0000003ce84d44bd in clone () from /lib64/libc.so.6
However if I run the same lua script from fs_cli it works fine. Can anyone please let me know what is going wrong when I call from the dialplan. Any help is greatly appreciated.
Thanks
Jyotshna
require "lualdap"
ld = assert (lualdap.open_simple ("192.168.2.xx"))
s= ld:search { base = "ou=People,dc=voalte,dc=com" , scope="subtree", filter = 'cn=A*', attrs = { "cn", "telephoneNumber" }}
for dn, attribs in s do
freeswitch.consoleLog("info",""..dn.."\n");
for name, values in pairs (attribs) do
-- stream:write("["..name.."] : ");
--stream:write (values);
--stream:write ("\n");
end
end
assert(ld:close())
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-dev/attachments/20110908/8fc4f522/attachment.html
Join us at ClueCon 2011 Aug 9-11, 2011
More information about the FreeSWITCH-dev
mailing list