[SR-Users] app_lua sr.sqlops.query exit status

jenus at cyberchaos.nl jenus at cyberchaos.nl
Wed Jan 10 14:01:47 CET 2018


Daniel,

Tested the config on a debian 9 machine with kamailio 5.1 (from 
packages) and this results in the same crash.

Jan

jenus at cyberchaos.nl schreef op 2018-01-10 13:46:
> Daniel,
> 
> I have attached a stripped version of the config. With this config it
> crashes on my machine (debian 8.10). If i disable any other module
> kamailio starts and keeps running. Looks like it does not matter what
> module i disable.
> 
> Jan
> 
> 
> 
> Daniel-Constantin Mierla schreef op 2018-01-10 13:02:
>> I have master (which should be more or less like latest 5.1) running
>> with app_lua, but on debian 9.0. From backtrace, no obvious issue.
>> 
>> Wondering if you can get a stripped down version of you config with as
>> less loaded modules as possible and minimal routing blocks that expose
>> the issue, so I can try it here. Try to load only the app_lua and the
>> modules it binds to and see if crashes ... if not, it could be a side
>> effect from other place.
>> 
>> Cheers,
>> Daniel
>> 
>> 
>> On 10.01.18 12:44, jenus at cyberchaos.nl wrote:
>>> Daniel,
>>> 
>>> (gdb) frame 5
>>> #5  0x00007fd3b2684870 in lua_sr_kemi_register_libs (L=0xeffdb0) at
>>> app_lua_sr.c:1973
>>> 1973    app_lua_sr.c: No such file or directory.
>>> (gdb) list
>>> 1968    in app_lua_sr.c
>>> (gdb) info locals
>>> _sr_crt_KSRMethods = 0xf0cf80
>>> emods = 0xa59a00 <_sr_kemi_modules>
>>> emods_size = 37
>>> i = 3
>>> k = 35
>>> n = 346
>>> mname =
>>> "KSR.uac_redirect\000\000\000\000\000\000\000\000\256\240B\262\323\177\000\000й\360\000\000\000\000\000\004\000\000\000\323\177\000\000
>>> ˏ\262\323\177\000\000\000\362\066\000\234\324\302Ͱ\375\357", '\000'
>>> <repeats 21 times>,
>>> "\065\246C\262\323\177\000\000@\265\225\356\376\177\000\000\000\000\000\000\377\377\377\377\000\000\000\000\000\000\000\000\177\241m\262\323\177\000"
>>> __FUNCTION__ = "lua_sr_kemi_register_libs"
>>> 
>>> (gdb) frame 6
>>> #6  0x00007fd3b26cf107 in lua_sr_openlibs (L=0xeffdb0) at
>>> app_lua_api.c:185
>>> 185     app_lua_api.c: No such file or directory.
>>> (gdb) list
>>> 180     in app_lua_api.c
>>> (gdb) info locals
>>> No locals.
>>> 
>>> 
>>> Jan
>>> 
>>> 
>>> Daniel-Constantin Mierla schreef op 2018-01-10 12:40:
>>>> Now the backtrace is different, gram the output for info locals in 
>>>> frame
>>>> 5 and 6.
>>>> 
>>>> Cheers,
>>>> Daniel
>>>> 
>>>> 
>>>> On 10.01.18 11:26, jenus at cyberchaos.nl wrote:
>>>>> I have overwritten the core file b y accident. I did a new 
>>>>> backtrace:
>>>>> 
>>>>> (gdb) backtrace
>>>>> #0  0x00007fd3b24365a0 in ?? () from
>>>>> /usr/lib/x86_64-linux-gnu/liblua5.1.so.0
>>>>> #1  0x00007fd3b2437b62 in ?? () from
>>>>> /usr/lib/x86_64-linux-gnu/liblua5.1.so.0
>>>>> #2  0x00007fd3b242a040 in lua_settable () from
>>>>> /usr/lib/x86_64-linux-gnu/liblua5.1.so.0
>>>>> #3  0x00007fd3b243a412 in luaL_findtable () from
>>>>> /usr/lib/x86_64-linux-gnu/liblua5.1.so.0
>>>>> #4  0x00007fd3b243a581 in luaL_openlib () from
>>>>> /usr/lib/x86_64-linux-gnu/liblua5.1.so.0
>>>>> #5  0x00007fd3b2684870 in lua_sr_kemi_register_libs (L=0xeffdb0) at
>>>>> app_lua_sr.c:1973
>>>>> #6  0x00007fd3b26cf107 in lua_sr_openlibs (L=0xeffdb0) at
>>>>> app_lua_api.c:185
>>>>> #7  0x00007fd3b26cf7c1 in lua_sr_init_probe () at app_lua_api.c:225
>>>>> #8  0x00007fd3b265b97d in child_init (rank=-127) at 
>>>>> app_lua_mod.c:197
>>>>> #9  0x0000000000549944 in init_mod_child (m=0x7fd3bc82cc70, 
>>>>> rank=-127)
>>>>> at core/sr_module.c:938
>>>>> #10 0x0000000000549c72 in init_child (rank=-127) at
>>>>> core/sr_module.c:964
>>>>> #11 0x0000000000422c1c in main_loop () at main.c:1576
>>>>> #12 0x000000000042aab9 in main (argc=3, argv=0x7ffeee95b548) at
>>>>> main.c:2646
>>>>> 
>>>>> (gdb) frame 7
>>>>> #7  0x00007fd3b26cf7c1 in lua_sr_init_probe () at app_lua_api.c:225
>>>>> 225     app_lua_api.c: No such file or directory.
>>>>> (gdb) list
>>>>> 220     in app_lua_api.c
>>>>> (gdb) info locals
>>>>> L = 0xeffdb0
>>>>> txt = 0x7fd3bd00dce7 <__fprintf+135> "H\201\304", <incomplete 
>>>>> sequence
>>>>> \330>
>>>>> li = 0x0
>>>>> sbuf = {st_dev = 0, st_ino = 206158430256, st_nlink = 
>>>>> 140732901208248,
>>>>> st_mode = 4002787296, st_uid = 32766, st_gid = 4002787464, __pad0 =
>>>>> 14, st_rdev = 140728898420739, st_size = 0,
>>>>>   st_blksize = 30795, st_blocks = 7970120, st_atim = {tv_sec =
>>>>> 7929944, tv_nsec = 0}, st_mtim = {tv_sec = 0, tv_nsec =
>>>>> 140732901208128}, st_ctim = {tv_sec = 140547210663782,
>>>>>     tv_nsec = 7938688}, __glibc_reserved = {-541165879423,
>>>>> 140732901208240, 5544260}}
>>>>> __FUNCTION__ = "lua_sr_init_probe"
>>>>> 
>>>>> I assume that in this case i need to do a "frame 7".
>>>>> 
>>>>> 
>>>>> Jan
>>>>> 
>>>>> Daniel-Constantin Mierla schreef op 2018-01-10 11:18:
>>>>>> Few more things to grab from core file with gdb -- take the output 
>>>>>> for
>>>>>> the next commands:
>>>>>> 
>>>>>> frame 16
>>>>>> 
>>>>>> list
>>>>>> 
>>>>>> info locals
>>>>>> 
>>>>>> Cheers,
>>>>>> Daniel
>>>>>> 
>>>>>> 
>>>>>> On 10.01.18 11:08, jenus at cyberchaos.nl wrote:
>>>>>>> Daniel,
>>>>>>> 
>>>>>>> Here are the app_lua settings:
>>>>>>> 
>>>>>>> # ----- app_lua params -----
>>>>>>> modparam("app_lua", "load", 
>>>>>>> "/etc/kamailio/kamailio_functions.lua")
>>>>>>> modparam("app_lua", "register", "sqlops")
>>>>>>> modparam("app_lua", "register", "siputils")
>>>>>>> modparam("app_lua", "register", "xhttp")
>>>>>>> 
>>>>>>> 
>>>>>>> Jan
>>>>>>> 
>>>>>>> 
>>>>>>> Daniel-Constantin Mierla schreef op 2018-01-10 11:03:
>>>>>>>> Can you give here the parameters you set for app_lua module?
>>>>>>>> 
>>>>>>>> Cheers,
>>>>>>>> Daniel
>>>>>>>> 
>>>>>>>> 
>>>>>>>> On 09.01.18 22:27, jenus at cyberchaos.nl wrote:
>>>>>>>>> Daniel,
>>>>>>>>> 
>>>>>>>>> Here is the backtrace.
>>>>>>>>> 
>>>>>>>>> (gdb) backtrace
>>>>>>>>> #0  0x00007fe41140e067 in __GI_raise (sig=sig at entry=6) at
>>>>>>>>> ../nptl/sysdeps/unix/sysv/linux/raise.c:56
>>>>>>>>> #1  0x00007fe41140f448 in __GI_abort () at abort.c:89
>>>>>>>>> #2  0x00007fe41144c1b4 in __libc_message
>>>>>>>>> (do_abort=do_abort at entry=1,
>>>>>>>>> fmt=fmt at entry=0x7fe411541210 "*** Error in `%s': %s: 0x%s
>>>>>>>>> ***\n") at
>>>>>>>>> ../sysdeps/posix/libc_fatal.c:175
>>>>>>>>> #3  0x00007fe41145198e in malloc_printerr (action=1,
>>>>>>>>> str=0x7fe41153d42a "realloc(): invalid next size", 
>>>>>>>>> ptr=<optimized
>>>>>>>>> out>) at malloc.c:4996
>>>>>>>>> #4  0x00007fe41145476b in _int_realloc 
>>>>>>>>> (av=av at entry=0x7fe41177e620
>>>>>>>>> <main_arena>, oldp=oldp at entry=0x21789c0, 
>>>>>>>>> oldsize=oldsize at entry=736,
>>>>>>>>> nb=nb at entry=1552) at malloc.c:4234
>>>>>>>>> #5  0x00007fe411455769 in __GI___libc_realloc 
>>>>>>>>> (oldmem=0x21789d0,
>>>>>>>>> bytes=1536) at malloc.c:3029
>>>>>>>>> #6  0x00007fe40c460cae in ?? () from
>>>>>>>>> /usr/lib/x86_64-linux-gnu/liblua5.1.so.0
>>>>>>>>> #7  0x00007fe40c45c9aa in ?? () from
>>>>>>>>> /usr/lib/x86_64-linux-gnu/liblua5.1.so.0
>>>>>>>>> #8  0x00007fe40c46166d in ?? () from
>>>>>>>>> /usr/lib/x86_64-linux-gnu/liblua5.1.so.0
>>>>>>>>> #9  0x00007fe40c4640b3 in ?? () from
>>>>>>>>> /usr/lib/x86_64-linux-gnu/liblua5.1.so.0
>>>>>>>>> #10 0x00007fe40c45ccd1 in ?? () from
>>>>>>>>> /usr/lib/x86_64-linux-gnu/liblua5.1.so.0
>>>>>>>>> #11 0x00007fe40c45c92e in ?? () from
>>>>>>>>> /usr/lib/x86_64-linux-gnu/liblua5.1.so.0
>>>>>>>>> #12 0x00007fe40c45d7bb in ?? () from
>>>>>>>>> /usr/lib/x86_64-linux-gnu/liblua5.1.so.0
>>>>>>>>> #13 0x00007fe40c45d8c2 in ?? () from
>>>>>>>>> /usr/lib/x86_64-linux-gnu/liblua5.1.so.0
>>>>>>>>> #14 0x00007fe40c459528 in lua_load () from
>>>>>>>>> /usr/lib/x86_64-linux-gnu/liblua5.1.so.0
>>>>>>>>> #15 0x00007fe40c469d8c in luaL_loadbuffer () from
>>>>>>>>> /usr/lib/x86_64-linux-gnu/liblua5.1.so.0
>>>>>>>>> #16 0x00007fe40c6fe7d7 in lua_sr_init_probe () at 
>>>>>>>>> app_lua_api.c:228
>>>>>>>>> #17 0x00007fe40c68a97d in child_init (rank=-127) at
>>>>>>>>> app_lua_mod.c:197
>>>>>>>>> #18 0x0000000000549944 in init_mod_child (m=0x7fe410c3b998,
>>>>>>>>> rank=-127)
>>>>>>>>> at core/sr_module.c:938
>>>>>>>>> #19 0x0000000000549662 in init_mod_child (m=0x7fe410c3bec0,
>>>>>>>>> rank=-127)
>>>>>>>>> at core/sr_module.c:935
>>>>>>>>> #20 0x0000000000549662 in init_mod_child (m=0x7fe410c3c708,
>>>>>>>>> rank=-127)
>>>>>>>>> at core/sr_module.c:935
>>>>>>>>> #21 0x0000000000549662 in init_mod_child (m=0x7fe410c3cd78,
>>>>>>>>> rank=-127)
>>>>>>>>> at core/sr_module.c:935
>>>>>>>>> #22 0x0000000000549662 in init_mod_child (m=0x7fe410c3d360,
>>>>>>>>> rank=-127)
>>>>>>>>> at core/sr_module.c:935
>>>>>>>>> #23 0x0000000000549662 in init_mod_child (m=0x7fe410c3e1e8,
>>>>>>>>> rank=-127)
>>>>>>>>> at core/sr_module.c:935
>>>>>>>>> #24 0x0000000000549662 in init_mod_child (m=0x7fe410c3e938,
>>>>>>>>> rank=-127)
>>>>>>>>> at core/sr_module.c:935
>>>>>>>>> #25 0x0000000000549662 in init_mod_child (m=0x7fe410c3f4c8,
>>>>>>>>> rank=-127)
>>>>>>>>> at core/sr_module.c:935
>>>>>>>>> #26 0x0000000000549662 in init_mod_child (m=0x7fe410c3fca0,
>>>>>>>>> rank=-127)
>>>>>>>>> at core/sr_module.c:935
>>>>>>>>> #27 0x0000000000549662 in init_mod_child (m=0x7fe410c40118,
>>>>>>>>> rank=-127)
>>>>>>>>> at core/sr_module.c:935
>>>>>>>>> #28 0x0000000000549662 in init_mod_child (m=0x7fe410c40780,
>>>>>>>>> rank=-127)
>>>>>>>>> at core/sr_module.c:935
>>>>>>>>> #29 0x0000000000549662 in init_mod_child (m=0x7fe410c422f8,
>>>>>>>>> rank=-127)
>>>>>>>>> at core/sr_module.c:935
>>>>>>>>> #30 0x0000000000549662 in init_mod_child (m=0x7fe410c42968,
>>>>>>>>> rank=-127)
>>>>>>>>> at core/sr_module.c:935
>>>>>>>>> #31 0x0000000000549662 in init_mod_child (m=0x7fe410c42e50,
>>>>>>>>> rank=-127)
>>>>>>>>> at core/sr_module.c:935
>>>>>>>>> #32 0x0000000000549662 in init_mod_child (m=0x7fe410c43b48,
>>>>>>>>> rank=-127)
>>>>>>>>> at core/sr_module.c:935
>>>>>>>>> #33 0x0000000000549662 in init_mod_child (m=0x7fe410c43f20,
>>>>>>>>> rank=-127)
>>>>>>>>> at core/sr_module.c:935
>>>>>>>>> #34 0x0000000000549662 in init_mod_child (m=0x7fe410c446e0,
>>>>>>>>> rank=-127)
>>>>>>>>> at core/sr_module.c:935
>>>>>>>>> #35 0x0000000000549662 in init_mod_child (m=0x7fe410c44bd0,
>>>>>>>>> rank=-127)
>>>>>>>>> at core/sr_module.c:935
>>>>>>>>> #36 0x0000000000549662 in init_mod_child (m=0x7fe410c44ec8,
>>>>>>>>> rank=-127)
>>>>>>>>> at core/sr_module.c:935
>>>>>>>>> #37 0x0000000000549662 in init_mod_child (m=0x7fe410c45378,
>>>>>>>>> rank=-127)
>>>>>>>>> at core/sr_module.c:935
>>>>>>>>> #38 0x0000000000549662 in init_mod_child (m=0x7fe410c458f0,
>>>>>>>>> rank=-127)
>>>>>>>>> at core/sr_module.c:935
>>>>>>>>> #39 0x0000000000549662 in init_mod_child (m=0x7fe410c45e48,
>>>>>>>>> rank=-127)
>>>>>>>>> at core/sr_module.c:935
>>>>>>>>> #40 0x0000000000549662 in init_mod_child (m=0x7fe410c464e8,
>>>>>>>>> rank=-127)
>>>>>>>>> at core/sr_module.c:935
>>>>>>>>> #41 0x0000000000549662 in init_mod_child (m=0x7fe410c47278,
>>>>>>>>> rank=-127)
>>>>>>>>> at core/sr_module.c:935
>>>>>>>>> #42 0x0000000000549662 in init_mod_child (m=0x7fe410c476f0,
>>>>>>>>> rank=-127)
>>>>>>>>> at core/sr_module.c:935
>>>>>>>>> #43 0x0000000000549662 in init_mod_child (m=0x7fe410c47b68,
>>>>>>>>> rank=-127)
>>>>>>>>> at core/sr_module.c:935
>>>>>>>>> #44 0x0000000000549c72 in init_child (rank=-127) at
>>>>>>>>> core/sr_module.c:964
>>>>>>>>> #45 0x0000000000422c1c in main_loop () at main.c:1576
>>>>>>>>> #46 0x000000000042aab9 in main (argc=3, argv=0x7ffe17f0e788) at
>>>>>>>>> main.c:2646
>>>>>>>>> 
>>>>>>>>> 
>>>>>>>>> Jan
>>>>>>>>> 
>>>>>>>>> Daniel-Constantin Mierla schreef op 2018-01-09 22:21:
>>>>>>>>>> Can you install the debug symbols for kamailio as well? There
>>>>>>>>>> should be
>>>>>>>>>> a kamailio-dbg package or so ...
>>>>>>>>>> 
>>>>>>>>>> Then take again the backtrace, it should provide more
>>>>>>>>>> information --
>>>>>>>>>> file and line for each frame, ...
>>>>>>>>>> 
>>>>>>>>>> Cheers,
>>>>>>>>>> Daniel
>>>>>>>>>> 
>>>>>>>>>> 
>>>>>>>>>> On 09.01.18 21:21, jenus at cyberchaos.nl wrote:
>>>>>>>>>>> Daniel,
>>>>>>>>>>> 
>>>>>>>>>>> Just upgraded to 5.1 but kamailio now generates a core file. 
>>>>>>>>>>> I'm
>>>>>>>>>>> running debian 8.10. It seems to crash on liblua5.1.so.0 :
>>>>>>>>>>> 
>>>>>>>>>>> Using host libthread_db library
>>>>>>>>>>> "/lib/x86_64-linux-gnu/libthread_db.so.1".
>>>>>>>>>>> Core was generated by `kamailio -m 1500'.
>>>>>>>>>>> Program terminated with signal SIGSEGV, Segmentation fault.
>>>>>>>>>>> #0  0x00007f30c17f25a0 in ?? () from
>>>>>>>>>>> /usr/lib/x86_64-linux-gnu/liblua5.1.so.0
>>>>>>>>>>> (gdb) backtrace
>>>>>>>>>>> #0  0x00007f30c17f25a0 in ?? () from
>>>>>>>>>>> /usr/lib/x86_64-linux-gnu/liblua5.1.so.0
>>>>>>>>>>> #1  0x00007f30c17f3b62 in ?? () from
>>>>>>>>>>> /usr/lib/x86_64-linux-gnu/liblua5.1.so.0
>>>>>>>>>>> #2  0x00007f30c17e6040 in lua_settable () from
>>>>>>>>>>> /usr/lib/x86_64-linux-gnu/liblua5.1.so.0
>>>>>>>>>>> #3  0x00007f30c17f6412 in luaL_findtable () from
>>>>>>>>>>> /usr/lib/x86_64-linux-gnu/liblua5.1.so.0
>>>>>>>>>>> #4  0x00007f30c17f6581 in luaL_openlib () from
>>>>>>>>>>> /usr/lib/x86_64-linux-gnu/liblua5.1.so.0
>>>>>>>>>>> #5  0x00007f30c1a40870 in lua_sr_kemi_register_libs () from
>>>>>>>>>>> /usr/lib/x86_64-linux-gnu/kamailio/modules/app_lua.so
>>>>>>>>>>> #6  0x00007f30c1a8b107 in lua_sr_openlibs () from
>>>>>>>>>>> /usr/lib/x86_64-linux-gnu/kamailio/modules/app_lua.so
>>>>>>>>>>> #7  0x00007f30c1a8b7c1 in lua_sr_init_probe () from
>>>>>>>>>>> /usr/lib/x86_64-linux-gnu/kamailio/modules/app_lua.so
>>>>>>>>>>> #8  0x00007f30c1a1797d in ?? () from
>>>>>>>>>>> /usr/lib/x86_64-linux-gnu/kamailio/modules/app_lua.so
>>>>>>>>>>> #9  0x0000000000549944 in ?? ()
>>>>>>>>>>> #10 0x0000000000549c72 in init_child ()
>>>>>>>>>>> #11 0x0000000000421498 in main_loop ()
>>>>>>>>>>> #12 0x000000000042aab9 in main ()
>>>>>>>>>>> 
>>>>>>>>>>> 
>>>>>>>>>>> 
>>>>>>>>>>> Thanks,
>>>>>>>>>>> 
>>>>>>>>>>> Jan
>>>>>>>>>>> 
>>>>>>>>>>> jenus at cyberchaos.nl schreef op 2018-01-09 20:53:
>>>>>>>>>>>> Daniel,
>>>>>>>>>>>> 
>>>>>>>>>>>> Currently running kamailio 5.0.5.
>>>>>>>>>>>> 
>>>>>>>>>>>> Jan
>>>>>>>>>>>> 
>>>>>>>>>>>> Daniel-Constantin Mierla schreef op 2018-01-09 13:27:
>>>>>>>>>>>>> Hello,
>>>>>>>>>>>>> 
>>>>>>>>>>>>> what version of kamailio are you using?
>>>>>>>>>>>>> 
>>>>>>>>>>>>> Cheers,
>>>>>>>>>>>>> Daniel
>>>>>>>>>>>>> 
>>>>>>>>>>>>> 
>>>>>>>>>>>>> On 07.01.18 22:14, jenus at cyberchaos.nl wrote:
>>>>>>>>>>>>>> Hello,
>>>>>>>>>>>>>> 
>>>>>>>>>>>>>> I'm doing some tests with a lua script and app_lua. I'm 
>>>>>>>>>>>>>> using
>>>>>>>>>>>>>> sr.sqlops.query to insert records into the database but 
>>>>>>>>>>>>>> would
>>>>>>>>>>>>>> like to
>>>>>>>>>>>>>> test the exit status of the sql query. In kamailio i can 
>>>>>>>>>>>>>> do:
>>>>>>>>>>>>>> 
>>>>>>>>>>>>>> if(!sql_query("kamailio", "INSERT INTO subscriber ..."))
>>>>>>>>>>>>>> 
>>>>>>>>>>>>>> Is there some kind of exit status for the lua function
>>>>>>>>>>>>>> sr.sqlops.query
>>>>>>>>>>>>>> in order to do the same check in lua? In other words, is 
>>>>>>>>>>>>>> it
>>>>>>>>>>>>>> possible
>>>>>>>>>>>>>> to check if a sql query was successful in lua? The result
>>>>>>>>>>>>>> seems
>>>>>>>>>>>>>> to be
>>>>>>>>>>>>>> nill in all cases for a INSERT in lua using 
>>>>>>>>>>>>>> sr.sqlops.query.
>>>>>>>>>>>>>> 
>>>>>>>>>>>>>> 
>>>>>>>>>>>>>> Thanks,
>>>>>>>>>>>>>> 
>>>>>>>>>>>>>> Jan Hazenberg
>>>>>>>>>>>>>> 
>>>>>>>>>>>>>> _______________________________________________
>>>>>>>>>>>>>> Kamailio (SER) - Users Mailing List
>>>>>>>>>>>>>> sr-users at lists.kamailio.org
>>>>>>>>>>>>>> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
>>>>>>>>>>>> 
>>>>>>>>>>>> 
>>>>>>>>>>>> _______________________________________________
>>>>>>>>>>>> Kamailio (SER) - Users Mailing List
>>>>>>>>>>>> sr-users at lists.kamailio.org
>>>>>>>>>>>> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
>>>>>>>>>>> 
>>>>>>>>> 
>>>>>>> 
>>>>> 
>>> 
> 
> _______________________________________________
> Kamailio (SER) - Users Mailing List
> sr-users at lists.kamailio.org
> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users




More information about the sr-users mailing list