I've installed kamailio (3.2, 3.2-nightly, dev-nightly) for debian unstable (wheezy) using repository at http://deb.kamailio.org and constantly get a coredump with this lua code:
-- SIP request routing function route_request(name) sr.dbg("routing SIP request from Lua [" .. name .. "]\n")
-- initial checks of SIP request if sr.maxfwd.process_maxfwd(10) < 0 then sr.sl.send_reply(483,"Too Many Hops") return end end
I've started with an example at this page http://kb.asipto.com/kamailio:usage:k32-lua-routing, and then just reduced the lua script to code above.
If I do comment sr.maxfwd.process_maxfwd(10) it passes. It is impossible to call sr.modf("mf_maxfwd...") because it says about fixups.
What's wrong?
-- With best regards, Roman Galeev.
Hello,
can you send the backtrace? Locate the core file and do:
gdb /path/to/kamailio /path/to/corefile bt
Cheers, Daniel
On 1/4/12 3:39 AM, (by way of noc@nelcom-voip.com) wrote:
I've installed kamailio (3.2, 3.2-nightly, dev-nightly) for debian unstable (wheezy) using repository at http://deb.kamailio.org and constantly get a coredump with this lua code:
-- SIP request routing function route_request(name) sr.dbg("routing SIP request from Lua [" .. name .. "]\n")
-- initial checks of SIP request if sr.maxfwd.process_maxfwd(10)< 0 then sr.sl.send_reply(483,"Too Many Hops") return end
end
I've started with an example at this page http://kb.asipto.com/kamailio:usage:k32-lua-routing, and then just reduced the lua script to code above.
If I do comment sr.maxfwd.process_maxfwd(10) it passes. It is impossible to call sr.modf("mf_maxfwd...") because it says about fixups.
What's wrong?
-- With best regards, Roman Galeev.
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
На Wed, 04 Jan 2012 09:46:47 +0100 Daniel-Constantin Mierla miconda@gmail.com записано:
Hello,
can you send the backtrace? Locate the core file and do:
gdb /path/to/kamailio /path/to/corefile bt
Here is what is says in log: 0(20428) DEBUG: <core> [receive.c:146]: After parse_msg... 0(20428) DEBUG: <core> [receive.c:187]: preparing to run routing scripts... 0(20428) DEBUG: app_lua [app_lua_api.c:380]: running Lua string: [[route_request([[MAIN]])]] 0(20428) DEBUG: app_lua [app_lua_api.c:381]: lua top index is: 10 0(20428) DEBUG: app_lua [app_lua_sr.c:63]: routing SIP request from Lua [MAIN]
Here is the backtrace: (gdb) bt #0 0x00000000 in ?? () #1 0xb6ffd21c in ?? () from /usr/lib/kamailio/modules/app_lua.so #2 0xb6fb828e in ?? () from /usr/lib/i386-linux-gnu/liblua5.1.so.0 #3 0xb6fc634b in ?? () from /usr/lib/i386-linux-gnu/liblua5.1.so.0 #4 0xb6fb84f4 in ?? () from /usr/lib/i386-linux-gnu/liblua5.1.so.0 #5 0xb6fb3096 in ?? () from /usr/lib/i386-linux-gnu/liblua5.1.so.0 #6 0xb6fb76f3 in ?? () from /usr/lib/i386-linux-gnu/liblua5.1.so.0 #7 0xb6fb8886 in ?? () from /usr/lib/i386-linux-gnu/liblua5.1.so.0 #8 0xb6fb313d in lua_pcall () from /usr/lib/i386-linux-gnu/liblua5.1.so.0 #9 0xb6ff8b8e in app_lua_runstring () from /usr/lib/kamailio/modules/app_lua.so #10 0xb7003505 in ?? () from /usr/lib/kamailio/modules/app_lua.so #11 0x080623f2 in do_action () #12 0x080615a8 in run_actions () #13 0x080697b2 in run_actions_safe () #14 0x0810aecb in rval_get_int () #15 0x0810fd07 in rval_expr_eval_int () #16 0x0810fdd6 in rval_expr_eval_int () #17 0x080628d5 in do_action () #18 0x080615a8 in run_actions () #19 0x0806982d in run_top_route () #20 0x080e981e in receive_msg () #21 0x08178c01 in udp_rcv_loop () #22 0x080b26b6 in main_loop () #23 0x08061344 in main ()
Hello,
the debug symbols are missing, I will try to reproduce myself.
Cheers, Daniel
On 1/4/12 11:49 AM, noc@nelcom-voip.com wrote:
На Wed, 04 Jan 2012 09:46:47 +0100 Daniel-Constantin Mierlamiconda@gmail.com записано:
Hello,
can you send the backtrace? Locate the core file and do:
gdb /path/to/kamailio /path/to/corefile bt
Here is what is says in log: 0(20428) DEBUG:<core> [receive.c:146]: After parse_msg... 0(20428) DEBUG:<core> [receive.c:187]: preparing to run routing scripts... 0(20428) DEBUG: app_lua [app_lua_api.c:380]: running Lua string: [[route_request([[MAIN]])]] 0(20428) DEBUG: app_lua [app_lua_api.c:381]: lua top index is: 10 0(20428) DEBUG: app_lua [app_lua_sr.c:63]: routing SIP request from Lua [MAIN]
Here is the backtrace: (gdb) bt #0 0x00000000 in ?? () #1 0xb6ffd21c in ?? () from /usr/lib/kamailio/modules/app_lua.so #2 0xb6fb828e in ?? () from /usr/lib/i386-linux-gnu/liblua5.1.so.0 #3 0xb6fc634b in ?? () from /usr/lib/i386-linux-gnu/liblua5.1.so.0 #4 0xb6fb84f4 in ?? () from /usr/lib/i386-linux-gnu/liblua5.1.so.0 #5 0xb6fb3096 in ?? () from /usr/lib/i386-linux-gnu/liblua5.1.so.0 #6 0xb6fb76f3 in ?? () from /usr/lib/i386-linux-gnu/liblua5.1.so.0 #7 0xb6fb8886 in ?? () from /usr/lib/i386-linux-gnu/liblua5.1.so.0 #8 0xb6fb313d in lua_pcall () from /usr/lib/i386-linux-gnu/liblua5.1.so.0 #9 0xb6ff8b8e in app_lua_runstring () from /usr/lib/kamailio/modules/app_lua.so #10 0xb7003505 in ?? () from /usr/lib/kamailio/modules/app_lua.so #11 0x080623f2 in do_action () #12 0x080615a8 in run_actions () #13 0x080697b2 in run_actions_safe () #14 0x0810aecb in rval_get_int () #15 0x0810fd07 in rval_expr_eval_int () #16 0x0810fdd6 in rval_expr_eval_int () #17 0x080628d5 in do_action () #18 0x080615a8 in run_actions () #19 0x0806982d in run_top_route () #20 0x080e981e in receive_msg () #21 0x08178c01 in udp_rcv_loop () #22 0x080b26b6 in main_loop () #23 0x08061344 in main ()
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
Hello,
do you have maxfwd module loaded in kamailio.cfg? With it all worked fine for me.
There was a missing check if the module was not loaded that could caused the crash, I added the safety check for it and kamailio doesn't start anymore if a registered module to Lua API is not loaded in kamailio.cfg.
Cheers, Daniel
On 1/5/12 11:49 AM, Daniel-Constantin Mierla wrote:
Hello,
the debug symbols are missing, I will try to reproduce myself.
Cheers, Daniel
On 1/4/12 11:49 AM, noc@nelcom-voip.com wrote:
На Wed, 04 Jan 2012 09:46:47 +0100 Daniel-Constantin Mierlamiconda@gmail.com записано:
Hello,
can you send the backtrace? Locate the core file and do:
gdb /path/to/kamailio /path/to/corefile bt
Here is what is says in log: 0(20428) DEBUG:<core> [receive.c:146]: After parse_msg... 0(20428) DEBUG:<core> [receive.c:187]: preparing to run routing scripts... 0(20428) DEBUG: app_lua [app_lua_api.c:380]: running Lua string: [[route_request([[MAIN]])]] 0(20428) DEBUG: app_lua [app_lua_api.c:381]: lua top index is: 10 0(20428) DEBUG: app_lua [app_lua_sr.c:63]: routing SIP request from Lua [MAIN]
Here is the backtrace: (gdb) bt #0 0x00000000 in ?? () #1 0xb6ffd21c in ?? () from /usr/lib/kamailio/modules/app_lua.so #2 0xb6fb828e in ?? () from /usr/lib/i386-linux-gnu/liblua5.1.so.0 #3 0xb6fc634b in ?? () from /usr/lib/i386-linux-gnu/liblua5.1.so.0 #4 0xb6fb84f4 in ?? () from /usr/lib/i386-linux-gnu/liblua5.1.so.0 #5 0xb6fb3096 in ?? () from /usr/lib/i386-linux-gnu/liblua5.1.so.0 #6 0xb6fb76f3 in ?? () from /usr/lib/i386-linux-gnu/liblua5.1.so.0 #7 0xb6fb8886 in ?? () from /usr/lib/i386-linux-gnu/liblua5.1.so.0 #8 0xb6fb313d in lua_pcall () from /usr/lib/i386-linux-gnu/liblua5.1.so.0 #9 0xb6ff8b8e in app_lua_runstring () from /usr/lib/kamailio/modules/app_lua.so #10 0xb7003505 in ?? () from /usr/lib/kamailio/modules/app_lua.so #11 0x080623f2 in do_action () #12 0x080615a8 in run_actions () #13 0x080697b2 in run_actions_safe () #14 0x0810aecb in rval_get_int () #15 0x0810fd07 in rval_expr_eval_int () #16 0x0810fdd6 in rval_expr_eval_int () #17 0x080628d5 in do_action () #18 0x080615a8 in run_actions () #19 0x0806982d in run_top_route () #20 0x080e981e in receive_msg () #21 0x08178c01 in udp_rcv_loop () #22 0x080b26b6 in main_loop () #23 0x08061344 in main ()
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
-- Daniel-Constantin Mierla -- http://www.asipto.com http://linkedin.com/in/miconda -- http://twitter.com/miconda
На Fri, 06 Jan 2012 09:38:42 +0100 Daniel-Constantin Mierla miconda@gmail.com записано:
Hello,
do you have maxfwd module loaded in kamailio.cfg? With it all worked fine for me.
Yes I have.
There was a missing check if the module was not loaded that could caused the crash, I added the safety check for it and kamailio doesn't start anymore if a registered module to Lua API is not loaded in kamailio.cfg.
Please see config files attached.
Hello,
On 1/6/12 10:24 AM, noc@nelcom-voip.com wrote:
На Fri, 06 Jan 2012 09:38:42 +0100 Daniel-Constantin Mierlamiconda@gmail.com записано:
Hello,
do you have maxfwd module loaded in kamailio.cfg? With it all worked fine for me.
Yes I have.
There was a missing check if the module was not loaded that could caused the crash, I added the safety check for it and kamailio doesn't start anymore if a registered module to Lua API is not loaded in kamailio.cfg.
Please see config files attached.
can you set debug=3 in the config file and send all log messages from start to the moment of crash?
Cheers, Daniel
На Fri, 06 Jan 2012 10:58:35 +0100 Daniel-Constantin Mierla miconda@gmail.com записано:
Hello,
On 1/6/12 10:24 AM, noc@nelcom-voip.com wrote:
На Fri, 06 Jan 2012 09:38:42 +0100 Daniel-Constantin Mierlamiconda@gmail.com записано:
Hello,
do you have maxfwd module loaded in kamailio.cfg? With it all worked fine for me.
Yes I have.
There was a missing check if the module was not loaded that could caused the crash, I added the safety check for it and kamailio doesn't start anymore if a registered module to Lua API is not loaded in kamailio.cfg.
Please see config files attached.
can you set debug=3 in the config file and send all log messages from start to the moment of crash?
Cheers, Daniel
На Thu, 05 Jan 2012 11:49:49 +0100 Daniel-Constantin Mierla miconda@gmail.com записано:
Hello,
the debug symbols are missing, I will try to reproduce myself.
I've managed to build it with debug symbols included.
#0 0x00000000 in ?? () #1 0xb70b121c in lua_sr_maxfwd_process_maxfwd (L=0xa1b77c0) at app_lua_exp.c:1001 #2 0xb706a28e in ?? () from /usr/lib/i386-linux-gnu/liblua5.1.so.0 #3 0xb707834b in ?? () from /usr/lib/i386-linux-gnu/liblua5.1.so.0 #4 0xb706a4f4 in ?? () from /usr/lib/i386-linux-gnu/liblua5.1.so.0 #5 0xb7065096 in ?? () from /usr/lib/i386-linux-gnu/liblua5.1.so.0 #6 0xb70696f3 in ?? () from /usr/lib/i386-linux-gnu/liblua5.1.so.0 #7 0xb706a886 in ?? () from /usr/lib/i386-linux-gnu/liblua5.1.so.0 #8 0xb706513d in lua_pcall () from /usr/lib/i386-linux-gnu/liblua5.1.so.0 #9 0xb70acb8e in app_lua_runstring (msg=0xb73202b8, script=0xb70c4920 "route_request([[MAIN]])") at app_lua_api.c:383 #10 0xb70b7505 in w_app_lua_runstring (msg=0xb73202b8, script=0xb731f03c "\254\215\062\267 ", extra=0x0) at app_lua_mod.c:204 #11 0x080623f2 in do_action (h=0xbfdc60b8, a=0xb731eee8, msg=0xb73202b8) at action.c:1122 #12 0x080615a8 in run_actions (h=<optimized out>, a=0xb731eee8, msg=0xb73202b8) at action.c:1610 #13 0x080697b2 in run_actions_safe (h=0xbfdc66b8, a=0xb731eee8, msg=0xb73202b8) at action.c:1662 #14 0x0810ae2b in rval_get_int (h=0xbfdc66b8, msg=0xb73202b8, i=0xbfdc63d0, rv=0xb731f43c, cache=0x0) at rvalue.c:920 #15 0x0810fc67 in rval_expr_eval_int (h=0xbfdc66b8, msg=0xb73202b8, res=0xbfdc63d0, rve=0xb731f438) at rvalue.c:1914 #16 0x0810fd36 in rval_expr_eval_int (h=0xbfdc66b8, msg=0xb73202b8, res=0xbfdc6644, rve=0xb731f7ec) at rvalue.c:1922 #17 0x080628d5 in do_action (h=0xbfdc66b8, a=0xb731fda4, msg=0xb73202b8) at action.c:1092 #18 0x080615a8 in run_actions (h=<optimized out>, a=0xb731fda4, msg=0xb73202b8) at action.c:1610 #19 0x0806982d in run_top_route (a=0xb731fda4, msg=0xb73202b8, c=0x0) at action.c:1683 #20 0x080e977e in receive_msg ( buf=0x82cb580 "INVITE sip:100@127.0.0.1 SIP/2.0\r\nVia: SIP/2.0/UDP 192.168.2.4:5061;rport;branch=z9hG4bK868105864\r\nFrom: sip:101@127.0.0.1;tag=1875811571\r\nTo: sip:100@127.0.0.1\r\nCall-ID: 1581836776\r\nCSeq: 20 INVI"..., len=<optimized out>, rcv_info=0xbfdc68cc) at receive.c:206 #21 0x08178b61 in udp_rcv_loop () at udp_server.c:544 #22 0x080b2616 in main_loop () at main.c:1585 #23 0x08061344 in main (argc=1, argv=0xbfdc6b64) at main.c:2475
Hello,
it should be fixed in 3.2 and master branches. The problem was that you registered auth api to Lua but you didn't load the auth module:
0(19347) DEBUG:<core> [sr_module.c:673]: find_export_record:<bind_auth_s> not found 0(19347) ERROR: app_lua [../../modules/auth/api.h:150]: unable to find bind_auth function. Check if you load the auth module. 0(19347) ERROR: app_lua [app_lua_exp.c:1543]: cannot bind to AUTH API
The issue was that instead of exiting when a registered API was not found, the app_lua continued without loading the next API.
Can you try with latest branch 3.2 (nightly builts for 3.2 should have the fix as well).
Cheers, Daniel
On 1/9/12 9:36 AM, noc@nelcom-voip.com wrote:
На Thu, 05 Jan 2012 11:49:49 +0100 Daniel-Constantin Mierlamiconda@gmail.com записано:
Hello,
the debug symbols are missing, I will try to reproduce myself.
I've managed to build it with debug symbols included.
#0 0x00000000 in ?? () #1 0xb70b121c in lua_sr_maxfwd_process_maxfwd (L=0xa1b77c0) at app_lua_exp.c:1001 #2 0xb706a28e in ?? () from /usr/lib/i386-linux-gnu/liblua5.1.so.0 #3 0xb707834b in ?? () from /usr/lib/i386-linux-gnu/liblua5.1.so.0 #4 0xb706a4f4 in ?? () from /usr/lib/i386-linux-gnu/liblua5.1.so.0 #5 0xb7065096 in ?? () from /usr/lib/i386-linux-gnu/liblua5.1.so.0 #6 0xb70696f3 in ?? () from /usr/lib/i386-linux-gnu/liblua5.1.so.0 #7 0xb706a886 in ?? () from /usr/lib/i386-linux-gnu/liblua5.1.so.0 #8 0xb706513d in lua_pcall () from /usr/lib/i386-linux-gnu/liblua5.1.so.0 #9 0xb70acb8e in app_lua_runstring (msg=0xb73202b8, script=0xb70c4920 "route_request([[MAIN]])") at app_lua_api.c:383 #10 0xb70b7505 in w_app_lua_runstring (msg=0xb73202b8, script=0xb731f03c "\254\215\062\267 ", extra=0x0) at app_lua_mod.c:204 #11 0x080623f2 in do_action (h=0xbfdc60b8, a=0xb731eee8, msg=0xb73202b8) at action.c:1122 #12 0x080615a8 in run_actions (h=<optimized out>, a=0xb731eee8, msg=0xb73202b8) at action.c:1610 #13 0x080697b2 in run_actions_safe (h=0xbfdc66b8, a=0xb731eee8, msg=0xb73202b8) at action.c:1662 #14 0x0810ae2b in rval_get_int (h=0xbfdc66b8, msg=0xb73202b8, i=0xbfdc63d0, rv=0xb731f43c, cache=0x0) at rvalue.c:920 #15 0x0810fc67 in rval_expr_eval_int (h=0xbfdc66b8, msg=0xb73202b8, res=0xbfdc63d0, rve=0xb731f438) at rvalue.c:1914 #16 0x0810fd36 in rval_expr_eval_int (h=0xbfdc66b8, msg=0xb73202b8, res=0xbfdc6644, rve=0xb731f7ec) at rvalue.c:1922 #17 0x080628d5 in do_action (h=0xbfdc66b8, a=0xb731fda4, msg=0xb73202b8) at action.c:1092 #18 0x080615a8 in run_actions (h=<optimized out>, a=0xb731fda4, msg=0xb73202b8) at action.c:1610 #19 0x0806982d in run_top_route (a=0xb731fda4, msg=0xb73202b8, c=0x0) at action.c:1683 #20 0x080e977e in receive_msg ( buf=0x82cb580 "INVITE sip:100@127.0.0.1 SIP/2.0\r\nVia: SIP/2.0/UDP 192.168.2.4:5061;rport;branch=z9hG4bK868105864\r\nFrom:sip:101@127.0.0.1;tag=1875811571\r\nTo:sip:100@127.0.0.1\r\nCall-ID: 1581836776\r\nCSeq: 20 INVI"..., len=<optimized out>, rcv_info=0xbfdc68cc) at receive.c:206 #21 0x08178b61 in udp_rcv_loop () at udp_server.c:544 #22 0x080b2616 in main_loop () at main.c:1585 #23 0x08061344 in main (argc=1, argv=0xbfdc6b64) at main.c:2475
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
На Mon, 09 Jan 2012 10:36:04 +0100 Daniel-Constantin Mierla miconda@gmail.com записано:
Hello,
it should be fixed in 3.2 and master branches. The problem was that you registered auth api to Lua but you didn't load the auth module:
0(19347) DEBUG:<core> [sr_module.c:673]: find_export_record:<bind_auth_s> not found 0(19347) ERROR: app_lua [../../modules/auth/api.h:150]: unable to find bind_auth function. Check if you load the auth module. 0(19347) ERROR: app_lua [app_lua_exp.c:1543]: cannot bind to AUTH API
The issue was that instead of exiting when a registered API was not found, the app_lua continued without loading the next API.
Can you try with latest branch 3.2 (nightly builts for 3.2 should have the fix as well).
I've updated to 3.2 nightly, and now it fails with messages above, which seems to be just right. And if I don't register auth module with lua it works fine.
Thanks.
It seems at first glance that half of modules could be just replaced with small lua functions what is encouraging.
On 1/9/12 11:00 AM, noc@nelcom-voip.com wrote:
На Mon, 09 Jan 2012 10:36:04 +0100 Daniel-Constantin Mierlamiconda@gmail.com записано:
Hello,
it should be fixed in 3.2 and master branches. The problem was that you registered auth api to Lua but you didn't load the auth module:
0(19347) DEBUG:<core> [sr_module.c:673]: find_export_record:<bind_auth_s> not found 0(19347) ERROR: app_lua [../../modules/auth/api.h:150]: unable to find bind_auth function. Check if you load the auth module. 0(19347) ERROR: app_lua [app_lua_exp.c:1543]: cannot bind to AUTH API
The issue was that instead of exiting when a registered API was not found, the app_lua continued without loading the next API.
Can you try with latest branch 3.2 (nightly builts for 3.2 should have the fix as well).
I've updated to 3.2 nightly, and now it fails with messages above, which seems to be just right. And if I don't register auth module with lua it works fine.
ok, thanks for testing.
Thanks.
It seems at first glance that half of modules could be just replaced with small lua functions what is encouraging.
Indeed, lot of extensions can be done in Lua, at the end of the day, it is a programming language, it can do lot of what C can do.
Cheers, Daniel
На Mon, 09 Jan 2012 11:07:03 +0100 Daniel-Constantin Mierla miconda@gmail.com записано:
It seems at first glance that half of modules could be just replaced with small lua functions what is encouraging.
Indeed, lot of extensions can be done in Lua, at the end of the day, it is a programming language, it can do lot of what C can do.
I've tried to port my .cfg logic to lua and immediately get this:
0(29960) ERROR: app_lua [app_lua_sr.c:182]: function 'sanity_check' has fixup - cannot be used
and this:
0(31303) WARNING: <core> [sr_module.c:620]: /usr/lib/kamailio/modules/app_lua.so: exports dlflags interface is deprecated and it will not be supported in newer versions; consider using mod_register() instead
--
So, if there is a fixup in module function, how should I call it from Lua (in general)?
I guess that's why modules are need to be "registered" with Lua, and could you briefly describe the process of adopting of such functions?
На Mon, 09 Jan 2012 11:07:03 +0100 Daniel-Constantin Mierla miconda@gmail.com записано:
Indeed, lot of extensions can be done in Lua, at the end of the day, it is a programming language, it can do lot of what C can do.
I've managed to add sanity module to app_lua register method. Here is the patch attached.
Hello,
On 1/9/12 7:32 PM, noc@nelcom-voip.com wrote:
На Mon, 09 Jan 2012 11:07:03 +0100 Daniel-Constantin Mierlamiconda@gmail.com записано:
Indeed, lot of extensions can be done in Lua, at the end of the day, it is a programming language, it can do lot of what C can do.
I've managed to add sanity module to app_lua register method. Here is the patch attached.
thanks, I will apply the patch.
Cheers, Daniel