Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nat module crashes if app_lua initialize fail #3401

Closed
sznoname opened this issue Mar 23, 2023 · 1 comment
Closed

nat module crashes if app_lua initialize fail #3401

sznoname opened this issue Mar 23, 2023 · 1 comment

Comments

@sznoname
Copy link
Contributor

Description

nat module crashes if app_lua initialize fail.

Troubleshooting

Reproduction

kamailio.cfg

### kamailio5.6.4

debug=2
log_stderror=no
memdbg=5
memlog=5
log_facility=LOG_LOCAL0
log_prefix="{$mt $hdr(CSeq) $ci} "
children=4
auto_aliases=no
enable_sctp=no
# listen=udp:192.168.31.63:5060

# mpath="/usr/local/lib/kamailio/modules/"

loadmodule "kex.so"
loadmodule "corex.so"
loadmodule "tm.so"
loadmodule "tmx.so"
loadmodule "sl.so"
loadmodule "pv.so"
loadmodule "xlog.so"
loadmodule "ctl.so"
loadmodule "cfg_rpc.so"

loadmodule "nats.so"
loadmodule "app_lua.so"

# modparam("ctl", "binrpc", "unix:/run/kamailio/kamailio_ctl")

modparam("nats", "nats_url", "nats://127.0.0.1:4222")
modparam("nats", "num_publish_workers", 1)
modparam("nats", "subject_queue_group", "sipserver:group")

modparam("app_lua", "load", "/etc/kamailio/kamailio.lua")

request_route {
	sl_send_reply("200", "OK");
}

kamailio.lua

cjson = require "cjson" -- but without cjson

Debugging Data

gdb kamailio core

Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Core was generated by `kamailio'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x00007f6691e9c62b in ?? () from /lib/x86_64-linux-gnu/libuv.so.1
[Current thread is 1 (Thread 0x7f6692ac9740 (LWP 82969))]

bt
#0  0x00007f6691e9c62b in ?? () from /lib/x86_64-linux-gnu/libuv.so.1
#1  0x00007f6691ea3856 in ?? () from /lib/x86_64-linux-gnu/libuv.so.1
#2  0x00007f6691ea398f in uv_poll_stop () from /lib/x86_64-linux-gnu/libuv.so.1
#3  0x00007f6691f48b81 in nats_destroy_workers () at nats_mod.c:601
#4  0x00007f6691f48c01 in mod_destroy () at nats_mod.c:614
#5  0x000055dad0bb4752 in destroy_modules () at core/sr_module.c:842
#6  0x000055dad0977132 in cleanup (show_status=0) at main.c:561
#7  0x000055dad0978d97 in shutdown_children (sig=15, show_status=0) at main.c:704
#8  0x000055dad0993c7b in main (argc=1, argv=0x7ffd4ca63688) at main.c:3093

bt full
#0  0x00007f6691e9c62b in ?? () from /lib/x86_64-linux-gnu/libuv.so.1
No symbol table info available.
#1  0x00007f6691ea3856 in ?? () from /lib/x86_64-linux-gnu/libuv.so.1
No symbol table info available.
#2  0x00007f6691ea398f in uv_poll_stop () from /lib/x86_64-linux-gnu/libuv.so.1
No symbol table info available.
#3  0x00007f6691f48b81 in nats_destroy_workers () at nats_mod.c:601
        i = 0
        worker = 0x7f668dceee10
        pub_worker = 0x7f668dceeeb0
        __func__ = "nats_destroy_workers"
#4  0x00007f6691f48c01 in mod_destroy () at nats_mod.c:614
        __func__ = "mod_destroy"
#5  0x000055dad0bb4752 in destroy_modules () at core/sr_module.c:842
        t = 0x7f6692368870
        foo = 0x7f6692366d20
        __func__ = "destroy_modules"
#6  0x000055dad0977132 in cleanup (show_status=0) at main.c:561
        memlog = 0
        __func__ = "cleanup"
#7  0x000055dad0978d97 in shutdown_children (sig=15, show_status=0) at main.c:704
        __func__ = "shutdown_children"
#8  0x000055dad0993c7b in main (argc=1, argv=0x7ffd4ca63688) at main.c:3093
        cfg_stream = 0x55dad295c380
        c = -1
        r = 0
        tmp = 0x100000000 <error: Cannot access memory at address 0x100000000>
        tmp_len = 0
        port = 895
        proto = 0
        ahost = 0x0
        aport = 0
        options = 0x55dad0db4278 ":f:cm:M:dVIhEeb:l:L:n:vKrRDTN:W:w:t:u:g:P:G:SQ:O:a:A:x:X:Y:"
        ret = -1
        seed = 193248401
        rfd = 4
        debug_save = 0
        debug_flag = 0
        dont_fork_cnt = 0
        n_lst = 0xc000
        p = 0x0
--Type <RET> for more, q to quit, c to continue without paging--
        st = {st_dev = 22, st_ino = 830, st_nlink = 2, st_mode = 16832, st_uid = 0, st_gid = 0, __pad0 = 0, st_rdev = 0, st_size = 60, st_blksize = 4096, st_blocks = 0,
          st_atim = {tv_sec = 1679270080, tv_nsec = 182554285}, st_mtim = {tv_sec = 1679531455, tv_nsec = 805444368}, st_ctim = {tv_sec = 1679531455, tv_nsec = 805444368},
          __glibc_reserved = {0, 0, 0}}
        tbuf = "\000\000\000\000\000\000\000\000\377\377\377\377\000\000\000\000x\230ْf\177\000\000кܒf\177", '\000' <repeats 42 times>, "pvْf\177\000\000\r\000\000\000\000\000\000\000\230\341ɒf\177\000\000\230\066\246L\375\177\000\000H\355\350\320\332U\000\000 \260ܒf\177\000\000\256\217ڒf\177\000\000\001", '\000' <repeats 15 times>, "x\230ْf\177\000\000\300\370ڒf\177\000\000\274\032\255\222f\177\000\000\000\066\246L\375\177\000\000\001", '\000' <repeats 15 times>, "\230\066\246L\375\177\000\000ڱڒf\177\000\000\000\000\000\000\000\000\000\000"...
        option_index = 0
        long_options = {{name = 0x55dad0db66e6 "help", has_arg = 0, flag = 0x0, val = 104}, {name = 0x55dad0db1524 "version", has_arg = 0, flag = 0x0, val = 118}, {
            name = 0x55dad0db66eb "alias", has_arg = 1, flag = 0x0, val = 1024}, {name = 0x55dad0db66f1 "subst", has_arg = 1, flag = 0x0, val = 1025}, {
            name = 0x55dad0db66f7 "substdef", has_arg = 1, flag = 0x0, val = 1026}, {name = 0x55dad0db6700 "substdefs", has_arg = 1, flag = 0x0, val = 1027}, {
            name = 0x55dad0db670a "server-id", has_arg = 1, flag = 0x0, val = 1028}, {name = 0x55dad0db6714 "loadmodule", has_arg = 1, flag = 0x0, val = 1029}, {
            name = 0x55dad0db671f "modparam", has_arg = 1, flag = 0x0, val = 1030}, {name = 0x55dad0db6728 "log-engine", has_arg = 1, flag = 0x0, val = 1031}, {
            name = 0x55dad0db6733 "debug", has_arg = 1, flag = 0x0, val = 1032}, {name = 0x55dad0db6739 "cfg-print", has_arg = 0, flag = 0x0, val = 1033}, {
            name = 0x55dad0db6743 "atexit", has_arg = 1, flag = 0x0, val = 1034}, {name = 0x0, has_arg = 0, flag = 0x0, val = 0}}
        __func__ = "main"

Log Messages

(paste your log messages here)

SIP Traffic

(paste your sip traffic here)

Possible Solutions

Additional Information

  • Kamailio Version - output of kamailio -v
kamailio 5.6.4 (x86_64/linux) a004cf
  • Operating System:
Debian11
miconda added a commit that referenced this issue Apr 5, 2023
@miconda
Copy link
Member

miconda commented Apr 5, 2023

Should be fixed by the commit referenced above.

@miconda miconda closed this as completed Apr 5, 2023
linuxmaniac added a commit that referenced this issue Apr 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants