<!-- Kamailio Project uses GitHub Issues only for bugs in the code or feature requests. Please use this template only for bug reports.
If you have questions about using Kamailio or related to its configuration file, ask on sr-users mailing list:
* https://lists.kamailio.org/mailman3/postorius/lists/sr-users.lists.kamailio....
If you have questions about developing extensions to Kamailio or its existing C code, ask on sr-dev mailing list:
* https://lists.kamailio.org/mailman3/postorius/lists/sr-dev.lists.kamailio.or...
Please try to fill this template as much as possible for any issue. It helps the developers to troubleshoot the issue.
If there is no content to be filled in a section, the entire section can be removed.
You can delete the comments from the template sections when filling.
You can delete next line and everything above before submitting (it is a comment). -->
### Description
<!-- Explain what you did, what you expected to happen, and what actually happened. --> nat module crashes if app_lua initialize fail. ### Troubleshooting
#### Reproduction
<!-- If the issue can be reproduced, describe how it can be done. -->
kamailio.cfg
```txt ### 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 ```lua cjson = require "cjson" -- but without cjson ```
#### Debugging Data
<!-- If you got a core dump, use gdb to extract troubleshooting data - full backtrace, local variables and the list of the code at the issue location.
gdb /path/to/kamailio /path/to/corefile bt full info locals list
If you are familiar with gdb, feel free to attach more of what you consider to be relevant. -->
gdb kamailio core ```txt 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
<!-- Check the syslog file and if there are relevant log messages printed by Kamailio, add them next, or attach to issue, or provide a link to download them (e.g., to a pastebin site). -->
``` (paste your log messages here) ```
#### SIP Traffic
<!-- If the issue is exposed by processing specific SIP messages, grab them with ngrep or save in a pcap file, then add them next, or attach to issue, or provide a link to download them (e.g., to a pastebin site). -->
``` (paste your sip traffic here) ```
### Possible Solutions
<!-- If you found a solution or workaround for the issue, describe it. Ideally, provide a pull request with a fix. -->
### Additional Information
* **Kamailio Version** - output of `kamailio -v`
``` kamailio 5.6.4 (x86_64/linux) a004cf ```
* **Operating System**:
<!-- Details about the operating system, the type: Linux (e.g.,: Debian 8.4, Ubuntu 16.04, CentOS 7.1, ...), MacOS, xBSD, Solaris, ...; Kernel details (output of `lsb_release -a` and `uname -a`) -->
``` Debian11 ```
Should be fixed by the commit referenced above.
Closed #3401 as completed.