The pinging from the dispatcher module segfaults and then kamailio exits. It used to work on kamailio 4.4.3.
*dispatcher.list* ``` 31 sip:10.0.20.191:5062;transport=udp 8 0 socket=udp:10.0.20.193:5021 ```
*debug logging* ``` 21(2188) DEBUG: dispatcher [dispatch.c:2872]: ds_ping_set(): probing set #31, URI sip:10.0.20.191:5062;transport=udp 21(2188) DEBUG: <core> [socket_info.c:559]: grep_sock_info(): checking if host==us: 11==11 && [10.0.20.193] == [10.0.20.193] 21(2188) DEBUG: <core> [socket_info.c:566]: grep_sock_info(): checking if port 5021 (advertise 0) matches port 5021 21(2188) DEBUG: tm [uac.c:411]: t_uac_prepare(): DEBUG:tm:t_uac: next_hop=sip:10.0.20.191:5062;transport=udp 21(2188) DEBUG: tm [uac.c:152]: dlg2hash(): DEBUG: dlg2hash: 37511 21(2188) DEBUG: tm [uac.c:616]: send_prepared_request_impl(): send_prepared_request_impl: uac: 0x7ff37f776380 branch: 0 to 10.0.20.191:5062 0(2167) ALERT: <core> [main.c:743]: handle_sigs(): child process 2188 exited by a signal 11 0(2167) INFO: <core> [main.c:759]: handle_sigs(): terminating due to SIGCHLD ```
Please let me know if you need more information.
``kamailio -V`` and some related gdb output from the coredump would be nice
``` $ kamailio -V version: kamailio 5.0.0-dev7 (x86_64/linux) flags: STATS: Off, USE_TCP, USE_TLS, USE_SCTP, TLS_HOOKS, DISABLE_NAGLE, USE_MCAST, DNS_IP_HACK, SHM_MEM, SHM_MMAP, PKG_MALLOC, Q_MALLOC, F_MALLOC, TLSF_MALLOC, DBG_SR_MEMORY, USE_FUTEX, FAST_LOCK-ADAPTIVE_WAIT, USE_DNS_CACHE, USE_DNS_FAILOVER, USE_NAPTR, USE_DST_BLACKLIST, HAVE_RESOLV_RES ADAPTIVE_WAIT_LOOPS=1024, MAX_RECV_BUFFER_SIZE 262144, MAX_LISTEN 16, MAX_URI_SIZE 1024, BUF_SIZE 65535, DEFAULT PKG_SIZE 8MB poll method support: poll, epoll_lt, epoll_et, sigio_rt, select. id: unknown compiled with gcc 5.3.1 ```
From the coredump:
``` #0 0x00007f7078e1715a in ?? () from /usr/lib/x86_64-linux-gnu/kamailio/modules/tm.so #1 0x00007f7078e1bf00 in ?? () from /usr/lib/x86_64-linux-gnu/kamailio/modules/tm.so #2 0x00007f7078e22a37 in t_uac_with_ids () from /usr/lib/x86_64-linux-gnu/kamailio/modules/tm.so #3 0x00007f7078e271d7 in request () from /usr/lib/x86_64-linux-gnu/kamailio/modules/tm.so #4 0x00007f7076076db1 in ds_ping_set () from /usr/lib/x86_64-linux-gnu/kamailio/modules/dispatcher.so #5 0x00007f7076076c00 in ds_ping_set () from /usr/lib/x86_64-linux-gnu/kamailio/modules/dispatcher.so #6 0x00007f7076076c00 in ds_ping_set () from /usr/lib/x86_64-linux-gnu/kamailio/modules/dispatcher.so #7 0x0000000000474c27 in ?? () #8 0x000000000047b518 in slow_timer_main () #9 0x00000000004ec4a8 in main_loop () #10 0x000000000041d31d in main () ```
Here is the actual debug output :-)
``` #0 run_onsend (orig_msg=orig_msg@entry=0x0, dst=dst@entry=0x7f70720bde60, buf=<optimized out>, len=<optimized out>) at ../../onsend.h:80 onsnd_info = {to = 0x7f70720bde68, send_sock = 0x7f707a285ba8, buf = 0x7f70720bf2a8 "OPTIONS sip:10.0.20.191:5062;transport=udp SIP/2.0\r\nVia: SIP/2.0/UDP 10.0.20.193:5021;branch=z9hG4bK673d.161b70b", '0' <repeats 25 times>, ".0\r\nTo: sip:10.0.20.191:5062;transport=udp\r\nFrom: <sip:dispat"..., len = 411, msg = 0x0} ret = 1 ra_ctx = {rec_lev = 1913380352, run_flags = 32624, last_retcode = 48, jmp_env = {{__jmpbuf = {140730243347504, 140730243347248, 140730243348000, 140120926445056, 54134, 21, 26318, 7368058}, __mask_was_saved = 1913380448, __saved_mask = { __val = {0, 140730243347552, 140730243347704, 7368058, 21, 140120926445072, 10875460, 140121027388988, 140121062554736, 4294967295, 4294967295, 140120926350396, 21, 411, 140120926450344, 10877216}}}}} bctx = <optimized out> backup_route_type = 1 fwd_snd_flags_bak = <optimized out> rpl_snd_flags_bak = <optimized out> keng = 0x0 #1 0x00007f7078e1bf00 in send_prepared_request_impl (request=<optimized out>, retransmit=retransmit@entry=1, branch=branch@entry=0) at uac.c:618 t = 0x7f70720bdbf8 p_msg = 0x0 uac = 0x7f70720bde00 ip = {af = 2, len = 4, u = {addrl = {3205758986, 140730243347728}, addr32 = {3205758986, 0, 1344926992, 32766}, addr16 = {10, 48916, 0, 0, 62736, 20521, 32766, 0}, addr = "\n\000\024\277\000\000\000\000\020\365)P\376\177\000"}} ret = <optimized out> __func__ = "send_prepared_request_impl" #2 0x00007f7078e22a37 in t_uac_with_ids (uac_r=uac_r@entry=0x7ffe5029f620, ret_index=ret_index@entry=0x0, ret_label=ret_label@entry=0x0) at uac.c:683 request = 0x7f70720bde10 cell = 0x7f70720bdbf8 ret = 1 is_ack = <optimized out> branch_ret = <optimized out> i = 0 added_branches = 1 #3 0x00007f7078e22b29 in t_uac (uac_r=uac_r@entry=0x7ffe5029f620) at uac.c:658 No locals. #4 0x00007f7078e271d7 in request (uac_r=0x7ffe5029f620, ruri=<optimized out>, to=<optimized out>, from=<optimized out>, next_hop=<optimized out>) at uac.c:1005 callid = {s = 0x7f70790a6700 <callid_buf> "16f83c1827128151-26318@10.0.20.193", len = 34} fromtag = {s = 0x7f70790a65e0 <from_tag> "67a6bee51647e3e1ce6833e5724e26f7-c9ed", len = 37} dialog = 0x7f70720bd868 res = <optimized out> __func__ = "request" #5 0x00007f7076076db1 in ds_ping_set (node=0x7f70720a5620) at dispatch.c:2887 uac_r = {method = 0x7f70762975b0 <ds_ping_method>, headers = 0x0, body = 0x0, ssock = 0x7f70720a41f0, dialog = 0x7f70720bd868, cb_flags = 1024, cb = 0x7f707607fb80 <ds_options_callback>, cbp = 0x1f, callid = 0x0} i = 2 j = 0 __func__ = "ds_ping_set" #6 0x00007f7076076c00 in ds_ping_set (node=0x7f70720a5c08) at dispatch.c:2863 uac_r = {method = 0x0, headers = 0x0, body = 0xffffffffffff0000, ssock = 0xffffffffffffffff, dialog = 0x0, cb_flags = 0, cb = 0x0, cbp = 0x0, callid = 0x0} i = 1 j = <optimized out> __func__ = "ds_ping_set" #7 0x00007f7076076c00 in ds_ping_set (node=0x7f70720a3df0) at dispatch.c:2863 uac_r = {method = 0xffffffff, headers = 0x706d7a, body = 0x7f7075e39d80, ssock = 0x15, dialog = 0x6bca4aae, cb_flags = 5169481, cb = 0xaaa6c0 <is_ctx>, cbp = 0x7f707aa6ed96 <srandom_r+198>, callid = 0x0} i = 1 j = <optimized out> __func__ = "ds_ping_set" ```
This looks like an issue introduced by 2f080bd3af63678b900f9f537afbd187007eb089 by @gaaf . Being a local generated request, there is no incoming one and orig_msg==NULL (0x00). Some more checks need to be added there or a fake request has to be created.
I have no time now to investigate the difference between what dispatcher does vs the uac module.
Quickest fix now is probably to skip onsend if there is no orig_msg.
I'm not familiar with the uac module so I can't help with that. If the quick fix mentioned by @gaaf is fine I'll submit a PR.
BTW, if you don't use `onsend_route` everything works as expected.
Fixed with 9a1547e8815e697351b0795bb3b4e308e5440a6d
Closed #859.
Thanks!