=== Description === use $sel() in event_route from evapi module will cause segfault and kamailio crash.
=== How to re-produce ===
--- Step 1. kamailio.cfg: ---
# --- evapi params --- # loadmodule "evapi.so" modparam("evapi", "bind_addr", "127.0.0.1:8448") modparam("evapi", "netstring_format", 1) modparam("evapi", "workers", 4)
# --- set a custom options outside any route block self.MYIP = "1.2.3.4"
# --- set event_route for evapi and invoke $sel; both route will segfault and crash
event_route[evapi:connection-new] { xlog("L_NOTICE", "[ROUTEDEBUG][evapi:connection-new] new connection from $evapi(srcaddr):$evapi(srcport)"); xlog("L_NOTICE", "[ROUTEDEBUG][evapi:connection-new] TEST sel: $sel(cfg_get.self.MYIP)"); } event_route[evapi:message-received] { xlog("L_NOTICE", "[ROUTEDEBUG][evapi:message-received] test sel: $sel(cfg_get.self.MYIP)"); }
--- 2. try connect to evapi ---
You can use any client to try to connect or send message. in bash, you can just use the following command to connect to and send a message:
exec 3<>/dev/tcp/127.0.0.1/5014; printf "5:Hello," >&3;
=== Debug level 3 error log at event_route[evapi:connection-new] ===
Aug 12 16:35:07 SIP /home/pkg/kamailio/sbin/kamailio[47034]: NOTICE: <script>: [ROUTEDEBUG][evapi:connection-new] new connection from 127.0.0.1:27088 Aug 12 16:35:07 SIP /home/pkg/kamailio/sbin/kamailio[46977]: ALERT: <core> [main.c:728]: handle_sigs(): child process 47034 exited by a signal 11 Aug 12 16:35:07 SIP /home/pkg/kamailio/sbin/kamailio[46977]: ALERT: <core> [main.c:731]: handle_sigs(): core was not generated Aug 12 16:35:07 SIP /home/pkg/kamailio/sbin/kamailio[46977]: INFO: <core> [main.c:743]: handle_sigs(): terminating due to SIGCHLD Aug 12 16:35:07 SIP kernel: [28325875.619264] kamailio[47034]: segfault at 10 ip 00007f062cd91470 sp 00007fff5518e068 error 4 in libc-2.13.so[7f062cc6e000+182000] Aug 12 16:35:07 SIP /home/pkg/kamailio/sbin/kamailio[47056]: INFO: <core> [main.c:794]: sig_usr(): signal 15 received Aug 12 16:35:07 SIP /home/pkg/kamailio/sbin/kamailio[47057]: INFO: <core> [main.c:794]: sig_usr(): signal 15 received
--- Reply to this email directly or view it on GitHub: https://github.com/kamailio/kamailio/issues/287
# C. Debug level 3 error log at event_route[evapi:connection-new]
Aug 12 16:35:07 SIP /home/pkg/kamailio/sbin/kamailio[47034]: NOTICE: <script>: [ROUTEDEBUG][evapi:connection-new] new connection from 127.0.0.1:27088 Aug 12 16:35:07 SIP /home/pkg/kamailio/sbin/kamailio[46977]: ALERT: <core> [main.c:728]: handle_sigs(): child process 47034 exited by a signal 11 Aug 12 16:35:07 SIP /home/pkg/kamailio/sbin/kamailio[46977]: ALERT: <core> [main.c:731]: handle_sigs(): core was not generated Aug 12 16:35:07 SIP /home/pkg/kamailio/sbin/kamailio[46977]: INFO: <core> [main.c:743]: handle_sigs(): terminating due to SIGCHLD Aug 12 16:35:07 SIP kernel: [28325875.619264] kamailio[47034]: segfault at 10 ip 00007f062cd91470 sp 00007fff5518e068 error 4 in libc-2.13.so[7f062cc6e000+182000] Aug 12 16:35:07 SIP /home/pkg/kamailio/sbin/kamailio[47056]: INFO: <core> [main.c:794]: sig_usr(): signal 15 received Aug 12 16:35:07 SIP /home/pkg/kamailio/sbin/kamailio[47057]: INFO: <core> [main.c:794]: sig_usr(): signal 15 received
--- Reply to this email directly or view it on GitHub: https://github.com/kamailio/kamailio/issues/287#issuecomment-130231054
Can you try to generate the core dump file and attach here the backtrace from gdb?
To get the core, before running kamailio, do:
``` ulimit -c unlimited ```
Then start kamailio as root and reproduce the issue.
Having the backtrace will help to identify faster the exact part of the code crashing.
--- Reply to this email directly or view it on GitHub: https://github.com/kamailio/kamailio/issues/287#issuecomment-130234155
I am not sure is this the information you need:
I issue command:
`ulimit -c unlimited; /home/pkg/kamailio/sbin/kamailio -f /home/pkg/kamailio/etc/kamailio/kamailio.cfg -P /var/run/kamailio/kamailio.pid -m 1024 -M 1024 -u root -g root -w /home/corefiles`
then
`gdb /home/pkg/kamailio/sbin/kamailio /home/corefiles/coredump.20150812`
# OUTPUT /home/corefiles# gdb /home/pkg/kamailio/sbin/kamailio /home/corefiles/coredump.20150812 GNU gdb (GDB) 7.4.1-debian Copyright (C) 2012 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-linux-gnu". For bug reporting instructions, please see: http://www.gnu.org/software/gdb/bugs/... Reading symbols from /home/pkg/kamailio-4.3.1/sbin/kamailio...done. [New LWP 59317]
warning: Can't read pathname for load map: Input/output error. [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1". Core was generated by `/home/pkg/kamailio/sbin/kamailio -f /home/pkg/kamailio/etc/kamailio/kamailio.cf'. Program terminated with signal 11, Segmentation fault. #0 0x00007f936a038470 in ?? () from /lib/x86_64-linux-gnu/libc.so.6
--- Reply to this email directly or view it on GitHub: https://github.com/kamailio/kamailio/issues/287#issuecomment-130250129
Give the output of 'bt full' inside gdb.
--- Reply to this email directly or view it on GitHub: https://github.com/kamailio/kamailio/issues/287#issuecomment-130330316
Hi Daniel,
ok, thanks. Let me know if you need more information.
output from gdb bt full:
``` #0 0x00007f936a038470 in ?? () from /lib/x86_64-linux-gnu/libc.so.6 No symbol table info available. #1 0x00000000006b8f9e in select_cfg_var (res=0x7fffbc05c2c0, s=0x7f932a040af0, msg=0x7fffbc05cdc0) at cfg/cfg_select.c:227 group = 0x7f9329f35b70 var = 0x7f9329f54568 p = 0x10 i = 0 buf = '\000' <repeats 21 times> __FUNCTION__ = "select_cfg_var" #2 0x000000000056bbf3 in run_select (res=0x7fffbc05c2c0, s=0x7f932a040af0, msg=0x7fffbc05cdc0) at select.c:425 ret = 0 orig_level = 0 __FUNCTION__ = "run_select" #3 0x00007f92e6935885 in pv_get_select (msg=0x7fffbc05cdc0, param=0x7f932a03ff70, res=0x7fffbc05c3a0) at pv_select.c:61 s = {s = 0x0, len = 0} sel = 0x7f932a040af0 #4 0x00000000004fa298 in pv_get_spec_value (msg=0x7fffbc05cdc0, sp=0x7f932a03ff58, value=0x7fffbc05c3a0) at pvapi.c:1289 ret = 0 __FUNCTION__ = "pv_get_spec_value" #5 0x00000000004fa6f8 in pv_printf (msg=0x7fffbc05cdc0, list=0x7f932a2f20a8, buf=0x7f932a3420a8 "[ROUTEDEBUG][evapi:connection-new] TEST sel: tion from 127.0.0.1:28412\n", len=0x7fffbc05c498) at pvapi.c:1348 n = 45 tok = {rs = {s = 0x0, len = 0}, ri = 0, flags = 0} it = 0x7f932a2f20a8 cur = 0x7f932a3420d5 "tion from 127.0.0.1:28412\n" __FUNCTION__ = "pv_printf" #6 0x00007f92e5c5d950 in xl_print_log (msg=0x7fffbc05cdc0, list=0x7f932a2f20a8, buf=0x7f932a3420a8 "[ROUTEDEBUG][evapi:connection-new] TEST sel: tion from 127.0.0.1:28412\n", len=0x7fffbc05c498) at xl_lib.c:37 No locals. #7 0x00007f92e5c5e306 in xlog_helper (msg=0x7fffbc05cdc0, xm=0x7f932a32fa98, level=1, line=0, facility=-1) at xlog.c:215 txt = {s = 0x7f932a3420a8 "[ROUTEDEBUG][evapi:connection-new] TEST sel: tion from 127.0.0.1:28412\n", len = 4096} #8 0x00007f92e5c5f36d in xlog_2_helper (msg=0x7fffbc05cdc0, lev=0x7f932a2f2010 "", frm=0x7f932a32fa98 "\250 /*\223\177", mode=0, facility=-1) at xlog.c:284 level = 1 xlp = 0x7f932a2f2010 value = {rs = {s = 0x7f9329f40e88 "wC\306\345\222\177", len = 0}, ri = -1140472320, flags = 32767} __FUNCTION__ = "xlog_2_helper" #9 0x00007f92e5c5f3a9 in xlog_2 (msg=0x7fffbc05cdc0, lev=0x7f932a2f2010 "", frm=0x7f932a32fa98 "\250 /*\223\177") at xlog.c:292 No locals. #10 0x00000000004207cb in do_action (h=0x7fffbc05cc90, a=0x7f932a32f808, msg=0x7fffbc05cdc0) at action.c:1065 ret = -5 v = 384605665 dst = {send_sock = 0x7fffbc05ca30, to = {s = {sa_family = 49331, sa_data = "\374\346\222\177\000\000(Q3*\223\177\000"}, sin = { sin_family = 49331, sin_port = 59132, sin_addr = {s_addr = 32658}, sin_zero = "(Q3*\223\177\000"}, sin6 = {sin6_family = 49331, sin6_port = 59132, sin6_flowinfo = 32658, sin6_addr = {__in6_u = {__u6_addr8 = "(Q3*\223\177\000\000\250O\257?\000\000\000", __u6_addr16 = {20776, 10803, 32659, 0, 20392, 16303, 0, 0}, __u6_addr32 = {708006184, 32659, 1068453800, 0}}}, sin6_scope_id = 3876340720}}, id = 0, proto = 29 '\035', send_flags = {f = 0 '\000', blst_imask = 0 '\000'}} tmp = 0x7f9329f39420 "\r\001" new_uri = 0x7fffbc05d150 "" end = 0x3bc05cb10 <Address 0x3bc05cb10 out of bounds> crt = 0x0 cmd = 0x7f9329f40e88 len = 0 user = 0 uri = {user = {s = 0x7fffbc05c880 "\260\210A", len = 707739336}, passwd = {s = 0xffffffff <Address 0xffffffff out of bounds>, len = 384605665}, host = {s = 0x7fffbc05c910 <incomplete sequence \347>, len = 1781112768}, port = {s = 0x0, len = 0}, params = { s = 0x16ec9de1 <Address 0x16ec9de1 out of bounds>, len = -1140471648}, sip_params = {s = 0x61e550 "\005\363\a", len = 384605665}, headers = {s = 0x4188b0 "1\355I\211\321^H\211\342H\203\344\360PTI\307\300@\202n", len = -1140466128}, port_no = 51472, proto = 48133, type = 32767, flags = 5859193, transport = {s = 0x7f932a335128 "38.106.57.68", len = -1140471248}, ttl = { s = 0xc <Address 0xc out of bounds>, len = -1140466128}, user_param = {s = 0x0, len = 1777742339}, maddr = { s = 0x3000000030 <Address 0x3000000030 out of bounds>, len = -1140471368}, method = {s = 0x7fffbc05c8f0 "P\345a", len = -1140471520}, lr = {s = 0x61e550 "\005\363\a", len = 384605665}, r2 = { s = 0x4188b0 "1\355I\211\321^H\211\342H\203\344\360PTI\307\300@\202n", len = 45}, gr = {s = 0xe77c <Address 0xe77c out of bounds>, len = 12}, transport_val = {s = 0x7fffbc05c970 " \312\005\274\004", len = 6416283}, ttl_val = { s = 0x5a00000040 <Address 0x5a00000040 out of bounds>, len = -421825296}, user_param_val = { s = 0x7f92e6db68c0 "tmx: tmx_pretran.c", len = 1024}, maddr_val = {s = 0xe8254928 <Address 0xe8254928 out of bounds>, len = 703819136}, method_val = {s = 0x7f92e8254d60 "@A", len = 1068474984}, lr_val = { s = 0x4bc05ca20 <Address 0x4bc05ca20 out of bounds>, len = 7565648}, r2_val = { s = 0x2004188b0 <Address 0x2004188b0 out of bounds>, len = -418825424}, gr_val = {s = 0x7fffbc05ca10 "\220\312\005\274\377\177", len = 5859905}} next_hop = {user = {s = 0x1 <Address 0x1 out of bounds>, len = 1777716012}, passwd = {s = 0x7f92e66fb309 "", len = -1140468125}, host = {s = 0x7fffbc05cad8 "", len = 0}, port = {s = 0xe66fb2fd <Address 0xe66fb2fd out of bounds>, len = 1}, params = {s = 0x0, len = 4294832}, sip_params = {s = 0xbc05c720 <Address 0xbc05c720 out of bounds>, len = 0}, headers = { s = 0x4188b0 "1\355I\211\321^H\211\342H\203\344\360PTI\307\300@\202n", len = 0}, port_no = 0, proto = 0, type = ERROR_URI_T, flags = 3885045536, transport = {s = 0x7fffbc05cd10 "\001\200\255\373\003", len = 0}, ttl = { s = 0xffffffffffffffff <Address 0xffffffffffffffff out of bounds>, len = 0}, user_param = { s = 0x5e7093f26 <Address 0x5e7093f26 out of bounds>, len = -1140471600}, maddr = { s = 0x1000000042 <Address 0x1000000042 out of bounds>, len = 0}, method = {s = 0x7f92e72d3df0 "-59260@38.106.57.68", len = 1777865538}, lr = {s = 0xfbad8001 <Address 0xfbad8001 out of bounds>, len = -416465424}, r2 = { s = 0x7fffffffffff <Address 0x7fffffffffff out of bounds>, len = -416465424}, gr = {s = 0x7f92e72d3df0 "-59260@38.106.57.68", len = 1777716012}, transport_val = {s = 0x7f92e66fb308 "c", len = -416465565}, ttl_val = { s = 0x7fffbc05cbc8 "X\227\223\346\222\177", len = 0}, user_param_val = {s = 0x7f92e66fb2fd "%x%c%x%c%x%c", len = 0}, maddr_val = { s = 0x0, len = 0}, method_val = {s = 0xbc05c810 <Address 0xbc05c810 out of bounds>, len = 707730008}, lr_val = { s = 0x7f932a2f0000 "", len = 0}, r2_val = {s = 0x16ec9de1 <Address 0x16ec9de1 out of bounds>, len = 4294832}, gr_val = { s = 0x7fffbc05de30 "\017", len = 0}} u = 0xe64eba78 port = 0 dst_host = 0x3000000018 i = 0 flags = 0 avp = 0xe6982f01 st = {flags = 23, id = 0, name = {n = -1140470160, s = {s = 0x7fffbc05ce70 "", len = -1140470512}, re = 0x7fffbc05ce70}, avp = 0x7f9369f584f9} sct = 0x7fffbc05ca90 sjt = 0x7f9329f34f90 rve = 0x7fffbc05cba0 mct = 0x4188b0 rv = 0x7fffbc05cd00 rv1 = 0xe6984100 c1 = {cache_type = 4294832, val_type = RV_NONE, c = {avp_val = {n = 0, s = {s = 0x0, len = -1}, re = 0x0}, pval = {rs = {s = 0x0, len = -1}, ri = 0, flags = 0}}, i2s = "\030\000\000\000\005\000\000\000\260\311\005\274\377\177\000\000\020\315\005\274\377\177"} s = {s = 0x0, len = 384605472} srevp = {0x7f932a3420a8, 0x0} mod_f_params = {{type = NOSUBTYPE, u = {number = 0, string = 0x0, str = {s = 0x0, len = 0}, data = 0x0, attr = 0x0, select = 0x0}}, { type = NOSUBTYPE, u = {number = 0, string = 0x0, str = {s = 0x0, len = 0}, data = 0x0, attr = 0x0, select = 0x0}}, { type = NOSUBTYPE, u = {number = 0, string = 0x0, str = {s = 0x0, len = 0}, data = 0x0, attr = 0x0, select = 0x0}}, { type = NOSUBTYPE, u = {number = 0, string = 0x0, str = {s = 0x0, len = 0}, data = 0x0, attr = 0x0, select = 0x0}}, { type = NOSUBTYPE, u = {number = 0, string = 0x0, str = {s = 0x0, len = 0}, data = 0x0, attr = 0x0, select = 0x0}}, { type = NOSUBTYPE, u = {number = 0, string = 0x0, str = {s = 0x0, len = 0}, data = 0x0, attr = 0x0, select = 0x0}}, { type = NOSUBTYPE, u = {number = 0, string = 0x0, str = {s = 0x0, len = 0}, data = 0x0, attr = 0x0, select = 0x0}}, { type = NOSUBTYPE, u = {number = 0, string = 0x0, str = {s = 0x0, len = 0}, data = 0x0, attr = 0x0, select = 0x0}}} __FUNCTION__ = "do_action" #11 0x000000000042c7b3 in run_actions (h=0x7fffbc05cc90, a=0x7f932a32f4e8, msg=0x7fffbc05cdc0) at action.c:1548 t = 0x7f932a32f808 ret = 1 mod = 0x69f81342 ms = 0 __FUNCTION__ = "run_actions" #12 0x000000000042cef6 in run_top_route (a=0x7f932a32f4e8, msg=0x7fffbc05cdc0, c=0x0) at action.c:1634 ctx = {rec_lev = 1, run_flags = 0, last_retcode = 1, jmp_env = {{__jmpbuf = {140268844679640, -8309488683327211492, 140268844679628, 140268844679648, 140268844679872, 4617323949938593359, -8309488683503372260, 8309630180652824604}, __mask_was_saved = 0, __saved_mask = {__val = {140736347885088, 26, 3154497944, 18446744073709551615, 1, 17107353601, 140268889654661, 46797374853, 140736347885975, 140268889654661, 140268889654684, 3847701919, 140268889654661, 140736347885975, 0, 0}}}}} p = 0x7fffbc05cc90 ret = -1140470400 sfbk = 0 #13 0x00007f92e2a93f0f in evapi_run_cfg_route (evenv=0x7fffbc05d610, rt=11) at evapi_dispatch.c:127 backup_rt = 1 ctx = {rec_lev = 0, run_flags = 0, last_retcode = 0, jmp_env = {{__jmpbuf = {140268926998432, 140270044677616, 33833760, 140271115299150, 3328210909095473713, 3885039665, 140736347887156, 140736347887248}, __mask_was_saved = -492240436, __saved_mask = {__val = {140271115299289, 274877907008, 140268846856236, 140271118044840, 140268926998278, 48, 20992022246, 96, 21064914694, 3154498960, 140268844679640, 140271118044736, 48, 140268844679648, 140268844679872, 4617323949938593359}}}}} fmsg = 0x7fffbc05cdc0 tmsg = {id = 2, pid = 59317, tval = {tv_sec = 0, tv_usec = 0}, fwd_send_flags = {f = 0 '\000', blst_imask = 0 '\000'}, rpl_send_flags = {f = 0 '\000', blst_imask = 0 '\000'}, first_line = {type = 1, flags = 1, len = 38, u = {request = {method = { s = 0x7f92e79116e0 "OPTIONS sip:you@kamailio.org SIP/2.0\r\nVia: SIP/2.0/UDP 127.0.0.1\r\nFrom: you@kamailio.org;tag=123\r\nTo: you@kamailio.org\r\nCall-ID: 123\r\nCSeq: 1 OPTIONS\r\nContent-Length: 0\r\n\r\n", len = 7}, uri = { s = 0x7f92e79116e8 "sip:you@kamailio.org SIP/2.0\r\nVia: SIP/2.0/UDP 127.0.0.1\r\nFrom: you@kamailio.org;tag=123\r\nTo: you@kamailio.org\r\nCall-ID: 123\r\nCSeq: 1 OPTIONS\r\nContent-Length: 0\r\n\r\n", len = 20}, version = { s = 0x7f92e79116fd "SIP/2.0\r\nVia: SIP/2.0/UDP 127.0.0.1\r\nFrom: you@kamailio.org;tag=123\r\nTo: you@kamailio.org\r\nCall-ID: 123\r\nCSeq: 1 OPTIONS\r\nContent-Length: 0\r\n\r\n", len = 7}, method_value = 512}, reply = {version = { s = 0x7f92e79116e0 "OPTIONS sip:you@kamailio.org SIP/2.0\r\nVia: SIP/2.0/UDP 127.0.0.1\r\nFrom: you@kamailio.org;tag=123\r\nTo: you@kamailio.org\r\nCall-ID: 123\r\nCSeq: 1 OPTIONS\r\nContent-Length: 0\r\n\r\n", len = 7}, status = { s = 0x7f92e79116e8 "sip:you@kamailio.org SIP/2.0\r\nVia: SIP/2.0/UDP 127.0.0.1\r\nFrom: you@kamailio.org;tag=123\r\nTo: you@kamailio.org\r\nCall-ID: 123\r\nCSeq: 1 OPTIONS\r\nContent-Length: 0\r\n\r\n", len = 20}, reason = { s = 0x7f92e79116fd "SIP/2.0\r\nVia: SIP/2.0/UDP 127.0.0.1\r\nFrom: you@kamailio.org;tag=123\r\nTo: you@kamailio.org\r\nCall-ID: 123\r\nCSeq: 1 OPTIONS\r\nContent-Length: 0\r\n\r\n", len = 7}, statuscode = 512}}}, via1 = 0x7f932a334160, via2 = 0x0, headers = 0x7f9329f35c08, last_header = 0x7f9329f35c08, parsed_flag = 2, h_via1 = 0x7f9329f35c08, h_via2 = 0x0, callid = 0x0, to = 0x0, cseq = 0x0, from = 0x0, contact = 0x0, maxforwards = 0x0, route = 0x0, record_route = 0x0, content_type = 0x0, content_length = 0x0, authorization = 0x0, expires = 0x0, proxy_auth = 0x0, supported = 0x0, require = 0x0, proxy_require = 0x0, unsupported = 0x0, allow = 0x0, event = 0x0, accept = 0x0, accept_language = 0x0, organization = 0x0, priority = 0x0, subject = 0x0, user_agent = 0x0, server = 0x0, content_disposition = 0x0, diversion = 0x0, rpid = 0x0, refer_to = 0x0, session_expires = 0x0, min_se = 0x0, sipifmatch = 0x0, subscription_state = 0x0, date = 0x7fffbc05d610, identity = 0x0, identity_info = 0x0, pai = 0x0, ppi = 0x0, path = 0x0, privacy = 0x0, body = 0x0, eoh = 0x0, unparsed = 0x7f92e7911722 "From: you@kamailio.org;tag=123\r\nTo: you@kamailio.org\r\nCall-ID: 123\r\nCSeq: 1 OPTIONS\r\nContent-Length: 0\r\n\r\n", rcv = {src_ip = {af = 2, len = 4, u = {addrl = {2130706433, 0}, addr32 = {2130706433, 0, 0, 0}, addr16 = {1, 32512, 0, 0, 0, 0, 0, 0}, addr = "\001\000\000\177", '\000' <repeats 11 times>}}, dst_ip = {af = 2, len = 4, u = {addrl = {2130706433, 0}, addr32 = {2130706433, 0, 0, 0}, addr16 = {1, 32512, 0, 0, 0, 0, 0, 0}, addr = "\001\000\000\177", '\000' <repeats 11 times>}}, src_port = 5060, dst_port = 5060, proto_reserved1 = 0, proto_reserved2 = 0, src_su = {s = {sa_family = 0, sa_data = '\000' <repeats 13 times>}, sin = {sin_family = 0, sin_port = 0, sin_addr = {s_addr = 0}, sin_zero = "\000\000\000\000\000\000\000"}, sin6 = {sin6_family = 0, sin6_port = 0, sin6_flowinfo = 0, sin6_addr = {__in6_u = { __u6_addr8 = '\000' <repeats 15 times>, __u6_addr16 = {0, 0, 0, 0, 0, 0, 0, 0}, __u6_addr32 = {0, 0, 0, 0}}}, sin6_scope_id = 0}}, bind_address = 0x0, proto = 1 '\001'}, buf = 0x7f92e79116e0 "OPTIONS sip:you@kamailio.org SIP/2.0\r\nVia: SIP/2.0/UDP 127.0.0.1\r\nFrom: you@kamailio.org;tag=123\r\nTo: you@kamailio.org\r\nCall-ID: 123\r\nCSeq: 1 OPTIONS\r\nContent-Length: 0\r\n\r\n", len = 176, new_uri = {s = 0x0, len = 0}, dst_uri = { s = 0x0, len = 0}, parsed_uri_ok = 0, parsed_uri = {user = {s = 0x0, len = 0}, passwd = {s = 0x0, len = 0}, host = {s = 0x0, len = 0}, port = {s = 0x0, len = 0}, params = {s = 0x0, len = 0}, sip_params = {s = 0x0, len = 0}, headers = {s = 0x0, len = 0}, port_no = 0, proto = 0, type = ERROR_URI_T, flags = 0, transport = {s = 0x0, len = 0}, ttl = {s = 0x0, len = 0}, user_param = { s = 0x0, len = 0}, maddr = {s = 0x0, len = 0}, method = {s = 0x0, len = 0}, lr = {s = 0x0, len = 0}, r2 = {s = 0x0, len = 0}, gr = {s = 0x0, len = 0}, transport_val = {s = 0x0, len = 0}, ttl_val = {s = 0x0, len = 0}, user_param_val = {s = 0x0, len = 0}, maddr_val = {s = 0x0, len = 0}, method_val = {s = 0x0, len = 0}, lr_val = {s = 0x0, len = 0}, r2_val = {s = 0x0, len = 0}, gr_val = {s = 0x0, len = 0}}, parsed_orig_ruri_ok = 0, parsed_orig_ruri = {user = {s = 0x0, len = 0}, passwd = {s = 0x0, len = 0}, host = {s = 0x0, len = 0}, port = {s = 0x0, len = 0}, params = {s = 0x0, len = 0}, sip_params = {s = 0x0, len = 0}, headers = { s = 0x0, len = 0}, port_no = 0, proto = 0, type = ERROR_URI_T, flags = 0, transport = {s = 0x0, len = 0}, ttl = {s = 0x0, len = 0}, user_param = {s = 0x0, len = 0}, maddr = {s = 0x0, len = 0}, method = {s = 0x0, len = 0}, lr = {s = 0x0, len = 0}, r2 = {s = 0x0, len = 0}, gr = {s = 0x0, len = 0}, transport_val = {s = 0x0, len = 0}, ttl_val = {s = 0x0, len = 0}, user_param_val = {s = 0x0, len = 0}, maddr_val = {s = 0x0, len = 0}, method_val = {s = 0x0, len = 0}, lr_val = {s = 0x0, len = 0}, r2_val = {s = 0x0, len = 0}, gr_val = {s = 0x0, len = 0}}, add_rm = 0x0, body_lumps = 0x0, reply_lump = 0x0, add_to_branch_s = '\000' <repeats 57 times>, add_to_branch_len = 0, hash_index = 0, msg_flags = 0, flags = 0, set_global_address = { s = 0x0, len = 0}, set_global_port = {s = 0x0, len = 0}, force_send_socket = 0x0, path_vec = {s = 0x0, len = 0}, instance = { s = 0x0, len = 0}, reg_id = 0, ruid = {s = 0x0, len = 0}, location_ua = {s = 0x0, len = 0}, ldv = {flow = {decoded = 0, rcv = { src_ip = {af = 0, len = 0, u = {addrl = {0, 0}, addr32 = {0, 0, 0, 0}, addr16 = {0, 0, 0, 0, 0, 0, 0, 0}, addr = '\000' <repeats 15 times>}}, dst_ip = {af = 0, len = 0, u = {addrl = {0, 0}, addr32 = {0, 0, 0, 0}, addr16 = {0, 0, 0, 0, 0, 0, 0, 0}, addr = '\000' <repeats 15 times>}}, src_port = 0, dst_port = 0, proto_reserved1 = 0, proto_reserved2 = 0, src_su = {s = {sa_family = 0, sa_data = '\000' <repeats 13 times>}, sin = {sin_family = 0, sin_port = 0, sin_addr = {s_addr = 0}, sin_zero = "\000\000\000\000\000\000\000"}, sin6 = {sin6_family = 0, sin6_port = 0, sin6_flowinfo = 0, sin6_addr = {__in6_u = {__u6_addr8 = '\000' <repeats 15 times>, __u6_addr16 = {0, 0, 0, 0, 0, 0, 0, 0}, __u6_addr32 = {0, 0, 0, 0}}}, sin6_scope_id = 0}}, bind_address = 0x0, proto = 0 '\000'}}}} __FUNCTION__ = "evapi_run_cfg_route" #14 0x00007f92e2a97b51 in evapi_accept_client (loop=0x7f92e2a901e0, watcher=0x7fffbc05d810, revents=1) at evapi_dispatch.c:395 caddr = {sa_family = 2, sa_data = "n\374\177\000\000\001\000\000\000\000\000\000\000"} clen = 16 csock = 15 evapi_client = 0x20b8d10 i = 0 evenv = {eset = 1, conidx = 0, msg = {s = 0x0, len = 0}} __FUNCTION__ = "evapi_accept_client" #15 0x00007f92e288766f in ev_invoke_pending () from /usr/lib/libev.so.4 No symbol table info available. #16 0x00007f92e288a6f5 in ev_run () from /usr/lib/libev.so.4 No symbol table info available. #17 0x00007f92e2a937c0 in ev_loop (loop=0x7f92e2a901e0, flags=0) at /usr/include/ev.h:820 No locals. #18 0x00007f92e2a999ec in evapi_run_dispatcher (laddr=0x7f9329f53a60 "127.0.0.1", lport=5014) at evapi_dispatch.c:509 evapi_srv_sock = 11 evapi_srv_addr = {sin_family = 2, sin_port = 38419, sin_addr = {s_addr = 16777343}, sin_zero = "\000\000\000\000\000\000\000"} loop = 0x7f92e2a901e0 h = 0x7f936a29f620 io_server = {active = 1, pending = 0, priority = 0, data = 0x7f9369f18ba8, cb = 0x7f92e2a9636d <evapi_accept_client>, next = 0x0, fd = 11, events = 1} io_notify = {active = 1, pending = 0, priority = 0, data = 0x4188b0, cb = 0x7f92e2a97bf2 <evapi_recv_notify>, next = 0x0, fd = 14, events = 1} yes_true = 1 __FUNCTION__ = "evapi_run_dispatcher" #19 0x00007f92e2a9c479 in child_init (rank=0) at evapi_mod.c:182 pid = 0 i = 0 __FUNCTION__ = "child_init" #20 0x0000000000596a41 in init_mod_child (m=0x7f9329f49e40, rank=0) at sr_module.c:898 __FUNCTION__ = "init_mod_child" #21 0x0000000000596779 in init_mod_child (m=0x7f9329f4a298, rank=0) at sr_module.c:895 __FUNCTION__ = "init_mod_child" #22 0x0000000000596779 in init_mod_child (m=0x7f9329f4a5f0, rank=0) at sr_module.c:895 __FUNCTION__ = "init_mod_child" #23 0x0000000000596d55 in init_child (rank=0) at sr_module.c:924 No locals. #24 0x00000000004aafd3 in main_loop () at main.c:1650 i = 24 pid = 59287 si = 0x0 si_desc = "udp receiver child=23 sock=38.106.57.68:5003\000\000\000\000~/q\000\001\000\000\000\260t\325\347\222\177\000\000p\333\005\274\377\177\000\000\032\264N\000\000\000\000\000\300\333\005\274\377\177\000\000\230\071\063*\223\177\000\000\230j"\350\222\177\000\000\260t\325\347\222\177\000\000\341\235\354\026\000\000\000\000\260\210A\000\001\000\000" nrprocs = 24 __FUNCTION__ = "main_loop" #25 0x00000000004b0b5b in main (argc=15, argv=0x7fffbc05de38) at main.c:2533 cfg_stream = 0x2019010 c = -1 r = 0 tmp = 0x7fffbc05e762 "" tmp_len = 32659 port = 1787676528 proto = 0 options = 0x707db8 ":f:cm:M:dVIhEeb:l:L:n:vKrRDTN:W:w:t:u:g:P:G:SQ:O:a:A:" ret = -1 seed = 335014897 rfd = 5 debug_save = 0 debug_flag = 0 dont_fork_cnt = 0 n_lst = 0x76 p = 0x7fffbc05dd3e "" __FUNCTION__ = "main" quit ```
--- Reply to this email directly or view it on GitHub: https://github.com/kamailio/kamailio/issues/287#issuecomment-130346215
I tried to reproduce, but in my case it printed <null>, it didn't crash.
However, it was an issue because the cfg var values were not updated. In your case might have been some invalid default value there, resulting in a crash.
I pushed a patch to fix it -- can you test with commit 4404f75cf194e8fd727c2ffaeeea41d2193decf6 ?
--- Reply to this email directly or view it on GitHub: https://github.com/kamailio/kamailio/issues/287#issuecomment-133681026
**Nice, it works and won't crash anymore. Thanks!**
For the further readers who has same problem and couldn't apply this patch temporarily, **below is my workaround before this patch:**
1. load htable module 2. wrap a event route using htable:mod-init exported from htable 3. use $shv to substitute $sel cfg variables as cross-process global setting 4. then you can use $shv in un-patched evapi event_route ( or other modules which has similar situation, especially when async jobs to a non-main-sip process. )
``` loadmodule "htable.so"
event_route[htable:mod-init] { $shv(MYIP) = $sel(cfg_get.self.MYIP); }
```
--- Reply to this email directly or view it on GitHub: https://github.com/kamailio/kamailio/issues/287#issuecomment-134035171
Closed #287.
--- Reply to this email directly or view it on GitHub: https://github.com/kamailio/kamailio/issues/287#event-390125904