When we reload trusted table and using MySQL as database, kamailio crashes. This does not happen when using PostgreSQL
We only have one record in the database too: mysql> select * from trusted\G *************************** 1. row *************************** id: 1 src_ip: 192.168.110.152 proto: from_pattern: NULL ruri_pattern: NULL tag: fs02 priority: 0 1 row in set (0.00 sec)
--- Reply to this email directly or view it on GitHub: https://github.com/kamailio/kamailio/issues/228
here is debugging log
# kamcmd permissions.trustedReload 8(5433) DEBUG: ctl [../../io_wait.h:376]: io_watch_add(): DBG: io_watch_add(0x7fa9ddf08720, 9, 3, 0x2890680), fd_no=1 8(5433) DEBUG: ctl [io_listener.c:442]: handle_new_connect(): handle_stream read: new connection (1) on /var/run/kamailio/kamailio_ctl 8(5433) DEBUG: <core> [db_res.c:116]: db_new_result(): allocate 56 bytes for result set at 0x7fa9e0c05478 8(5433) DEBUG: db_mysql [km_res.c:66]: db_mysql_get_columns(): 6 columns returned from the query 8(5433) DEBUG: <core> [db_res.c:154]: db_allocate_columns(): allocate 48 bytes for result names at 0x7fa9e0c054f8 8(5433) DEBUG: <core> [db_res.c:165]: db_allocate_columns(): allocate 24 bytes for result types at 0x7fa9e0c05730 8(5433) DEBUG: db_mysql [km_res.c:84]: db_mysql_get_columns(): allocate 16 bytes for RES_NAMES[0] at 0x7fa9e0c055d0 8(5433) DEBUG: db_mysql [km_res.c:91]: db_mysql_get_columns(): RES_NAMES(0x7fa9e0c055d0)[0]=[src_ip] 8(5433) DEBUG: db_mysql [km_res.c:135]: db_mysql_get_columns(): use DB1_STRING result type 8(5433) DEBUG: db_mysql [km_res.c:84]: db_mysql_get_columns(): allocate 16 bytes for RES_NAMES[1] at 0x7fa9e0c056e8 8(5433) DEBUG: db_mysql [km_res.c:91]: db_mysql_get_columns(): RES_NAMES(0x7fa9e0c056e8)[1]=[proto] 8(5433) DEBUG: db_mysql [km_res.c:135]: db_mysql_get_columns(): use DB1_STRING result type 8(5433) DEBUG: db_mysql [km_res.c:84]: db_mysql_get_columns(): allocate 16 bytes for RES_NAMES[2] at 0x7fa9e0c05618 8(5433) DEBUG: db_mysql [km_res.c:91]: db_mysql_get_columns(): RES_NAMES(0x7fa9e0c05618)[2]=[from_pattern] 8(5433) DEBUG: db_mysql [km_res.c:135]: db_mysql_get_columns(): use DB1_STRING result type 8(5433) DEBUG: db_mysql [km_res.c:84]: db_mysql_get_columns(): allocate 16 bytes for RES_NAMES[3] at 0x7fa9e0c05420 8(5433) DEBUG: db_mysql [km_res.c:91]: db_mysql_get_columns(): RES_NAMES(0x7fa9e0c05420)[3]=[ruri_pattern] 8(5433) DEBUG: db_mysql [km_res.c:135]: db_mysql_get_columns(): use DB1_STRING result type 8(5433) DEBUG: db_mysql [km_res.c:84]: db_mysql_get_columns(): allocate 16 bytes for RES_NAMES[4] at 0x7fa9e0c05560 8(5433) DEBUG: db_mysql [km_res.c:91]: db_mysql_get_columns(): RES_NAMES(0x7fa9e0c05560)[4]=[tag] 8(5433) DEBUG: db_mysql [km_res.c:135]: db_mysql_get_columns(): use DB1_STRING result type 8(5433) DEBUG: db_mysql [km_res.c:84]: db_mysql_get_columns(): allocate 16 bytes for RES_NAMES[5] at 0x7fa9e0c05348 8(5433) DEBUG: db_mysql [km_res.c:91]: db_mysql_get_columns(): RES_NAMES(0x7fa9e0c05348)[5]=[priority] 8(5433) DEBUG: db_mysql [km_res.c:99]: db_mysql_get_columns(): use DB1_INT result type 8(5433) DEBUG: <core> [db_res.c:184]: db_allocate_rows(): allocate 16 bytes for rows at 0x7fa9e0c05390 8(5433) DEBUG: <core> [db_row.c:117]: db_allocate_row(): allocate 192 bytes for row values at 0x7fa9e0bc18f0 8(5433) DEBUG: <core> [db_val.c:115]: db_str2val(): converting STRING [192.168.110.152] 8(5433) DEBUG: <core> [db_val.c:115]: db_str2val(): converting STRING [] 8(5433) DEBUG: <core> [db_val.c:54]: db_str2val(): converting NULL value 8(5433) DEBUG: <core> [db_val.c:54]: db_str2val(): converting NULL value 8(5433) DEBUG: <core> [db_val.c:115]: db_str2val(): converting STRING [GRV-fs02] 8(5433) DEBUG: <core> [db_val.c:71]: db_str2val(): converting INT [0] ERROR: read reply failed: Success (0) 0(5424) ALERT: <core> [main.c:728]: handle_sigs(): child process 5433 exited by a signal 11 0(5424) ALERT: <core> [main.c:731]: handle_sigs(): core was not generated 0(5424) INFO: <core> [main.c:743]: handle_sigs(): terminating due to SIGCHLD 7(5432) INFO: <core> [main.c:794]: sig_usr(): signal 15 received 9(5434) INFO: <core> [main.c:794]: sig_usr(): signal 15 received 4(5429) INFO: <core> [main.c:794]: sig_usr(): signal 15 received 1(5426) INFO: <core> [main.c:794]: sig_usr(): signal 15 received 2(5427) INFO: <core> [main.c:794]: sig_usr(): signal 15 received 6(5431) INFO: <core> [main.c:794]: sig_usr(): signal 15 received 5(5430) INFO: <core> [main.c:794]: sig_usr(): signal 15 received 3(5428) 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/228#issuecomment-118094626
Try to get the coredump -- before running, run:
``` ulimit -c ulimited ```
Run as root if you don't get it as normal user.
Then take the backtrace -- 'bt full' with gdb from the core file -- and post it here.
I guess it is due to latest changes pushed to this module in devel branch.
--- Reply to this email directly or view it on GitHub: https://github.com/kamailio/kamailio/issues/228#issuecomment-118109380
(gdb) bt full #0 0x00007f17e53d3832 in reload_trusted_table () at trusted.c:96 cols = {0x7f17e55e7800, 0x7f17e55e7810, 0x7f17e55e7820, 0x7f17e55e7830, 0x7f17e55e7840, 0x7f17e55e7850} res = 0x7f17e8d9e530 row = 0x7f17e9898ea8 val = 0x1010 new_hash_table = 0xe6e6bd old_hash_table = 0xbc90e5 i = 25 priority = -1161140908 pattern = 0x101e6b92634 <Address 0x101e6b92634 out of bounds> ruri_pattern = 0x1030 <Address 0x1030 out of bounds> tag = 0x6300e6e6d7 <Address 0x6300e6e6d7 out of bounds> __FUNCTION__ = "reload_trusted_table" #1 0x00007f17e53d99d8 in reload_trusted_table_cmd () at trusted.c:610 __FUNCTION__ = "reload_trusted_table_cmd" #2 0x00007f17e53bfa06 in rpc_trusted_reload (rpc=0x7f17e60a0960, c=0x7ffcbaca6550) at mi.c:57 No locals. #3 0x00007f17e5e5ef51 in process_rpc_req (buf=0xe6e6b4 "\241\003\034\nwg'\221\032permissions.trustedReload", size=35, bytes_needed=0x7ffcbaca6734, sh=0x7ffcbaca66b0, saved_state=0xe7e6b8) at binrpc_run.c:674 err = 0 val = {name = {s = 0x0, len = -380056976}, type = 1, u = {strval = {s = 0xe6e6bd "permissions.trustedReload", len = 25}, fval = 7.4763737817801413e-317, intval = 15132349, end = 15132349}} rpc_e = 0x7f17e8d7ced8 f_ctx = {in = {ctx = {tlen = 28, cookie = 175597351, type = 0, flags = 1, offset = 28, in_struct = 0, in_array = 0}, s = 0xe6e6d7 "", end = 0xe6e6d7 "", record_no = 0, in_struct = 0}, out = {pkt = { body = 0xd68b20 "\270\224\211\351\027\177", end = 0xd69b20 "", crt = 0xd68b20 "\270\224\211\351\027\177"}, structs = {next = 0x7ffcbaca65a0, prev = 0x7ffcbaca65a0}}, send_h = 0x7ffcbaca66b0, method = 0xe6e6bd "permissions.trustedReload", gc = 0x0, replied = 0, err_code = 0, err_phrase = {s = 0x0, len = 0}} ctx = 0x7ffcbaca6550 __FUNCTION__ = "process_rpc_req" #4 0x00007f17e5e8e942 in handle_stream_read (s_c=0xe6e680, idx=-1) at io_listener.c:511 bytes_free = 65535 bytes_read = 35 bytes_needed = 0 bytes_processed = 1 r = 0xe6e6a0 sh = {fd = 9, type = 0, from = {sa_in = {s = {sa_family = 26560, sa_data = "ʺ\002\000\000\000\001\000ʺ\374\177\000"}, sin = {sin_family = 26560, sin_port = 47818, sin_addr = {s_addr = 2}, sin_zero = "\001\000ʺ\374\177\000"}, sin6 = {sin6_family = 26560, sin6_port = 47818, sin6_flowinfo = 2, sin6_addr = {__in6_u = { __u6_addr8 = "\001\000ʺ\374\177\000\000\020tʺ\374\177\000", __u6_addr16 = {1, 47818, 32764, 0, 29712, 47818, 32764, 0}, __u6_addr32 = {3133800449, 32764, 3133830160, 32764}}}, sin6_scope_id = 8}}, sa_un = {sun_family = 26560, sun_path = "ʺ\002\000\000\000\001\000ʺ\374\177\000\000\020tʺ\374\177\000\000\b\000\000\000\000\000\000\000\001\000\000\000\000\000\000\000 \206\026\336\027\177\000\000\253\\000\000\000\000\000\000\b\276p\000\000\000\000\000\000\004\000\000\000\000\000\000Pgʺ\001\000\000\000 \206\026\336\027\177\000\000Pgʺ\374\177\000\000k\346\347\345\027\177\000\000\000\000\000\000\000"}}, from_len = 0} __FUNCTION__ = "handle_stream_read" #5 0x00007f17e5e90134 in handle_io (fm=0x7f17e8d7f7c0, events=1, idx=-1) at io_listener.c:706 ret = 1 __FUNCTION__ = "handle_io" #6 0x00007f17e5e88214 in io_wait_loop_epoll (h=0x7f17e60a1720, t=10, repeat=0) at ../../io_wait.h:1061 n = 1 r = 0 fm = 0x7f17e8d7f7c0 revents = 1 __FUNCTION__ = "io_wait_loop_epoll" #7 0x00007f17e5e8bdbc in io_listen_loop (fd_no=1, cs_lst=0xbc91b0) at io_listener.c:281 max_fd_no = 176 poll_err = 0x0 poll_method = 2 cs = 0x0 type = 2 __FUNCTION__ = "io_listen_loop" #8 0x00007f17e5e67406 in mod_child (rank=0) at ctl.c:320 pid = 0 cs = 0x7f17e9cc0c02 rpc_handler = 1 __FUNCTION__ = "mod_child" #9 0x00000000005a0317 in init_mod_child (m=0x7f17e8d3e4a8, rank=0) at sr_module.c:898 __FUNCTION__ = "init_mod_child" #10 0x00000000005a0040 in init_mod_child (m=0x7f17e8d3e990, rank=0) at sr_module.c:895 ---Type <return> to continue, or q <return> to quit--- __FUNCTION__ = "init_mod_child" #11 0x00000000005a0040 in init_mod_child (m=0x7f17e8d3ff18, rank=0) at sr_module.c:895 __FUNCTION__ = "init_mod_child" #12 0x00000000005a0040 in init_mod_child (m=0x7f17e8d40428, rank=0) at sr_module.c:895 __FUNCTION__ = "init_mod_child" #13 0x00000000005a0040 in init_mod_child (m=0x7f17e8d40778, rank=0) at sr_module.c:895 __FUNCTION__ = "init_mod_child" #14 0x00000000005a0040 in init_mod_child (m=0x7f17e8d40cf8, rank=0) at sr_module.c:895 __FUNCTION__ = "init_mod_child" #15 0x00000000005a0040 in init_mod_child (m=0x7f17e8d41080, rank=0) at sr_module.c:895 __FUNCTION__ = "init_mod_child" #16 0x00000000005a0040 in init_mod_child (m=0x7f17e8d416b0, rank=0) at sr_module.c:895 __FUNCTION__ = "init_mod_child" #17 0x00000000005a0040 in init_mod_child (m=0x7f17e8d41d18, rank=0) at sr_module.c:895 __FUNCTION__ = "init_mod_child" #18 0x00000000005a0040 in init_mod_child (m=0x7f17e8d42860, rank=0) at sr_module.c:895 __FUNCTION__ = "init_mod_child" #19 0x00000000005a0640 in init_child (rank=0) at sr_module.c:924 No locals. #20 0x00000000004ae61a in main_loop () at main.c:1650 i = 4 pid = 23721 si = 0x0 si_desc = "udp receiver child=3 sock=185.71.5.63:5060\000\000\000\000\000\000\b\276p\000\000\000\000\000\020tʺ\374\177", '\000' <repeats 18 times>, "0sʺ\374\177\000\000\310\001V\351\027\177\000\000\060\000\000\000\060\000\000\000x\333\326\350\027\177\000\000\060qʺ\374\177\000\000\000\000\000\000\001\000\000" nrprocs = 4 __FUNCTION__ = "main_loop" #21 0x00000000004b4065 in main (argc=13, argv=0x7ffcbaca7418) at main.c:2533 cfg_stream = 0xb50010 c = -1 r = 0 tmp = 0x7ffcbaca8f5a "" tmp_len = 0 port = 0 proto = 0 options = 0x7199c8 ":f:cm:M:dVIhEeb:l:L:n:vKrRDTN:W:w:t:u:g:P:G:SQ:O:a:A:" ret = -1 seed = 882959712 rfd = 4 debug_save = 0 debug_flag = 0 dont_fork_cnt = 0 n_lst = 0x7ffcbaca731e p = 0x5657f0 "s" __FUNCTION__ = "main" (gdb) (gdb)
--- Reply to this email directly or view it on GitHub: https://github.com/kamailio/kamailio/issues/228#issuecomment-118115080
I don't think this is related to recent changes to permissions module. I tested on version 4.3.0 before recent changes and same result Tested on version: kamailio 4.3.0 (x86_64/linux) 5e9862
--- Reply to this email directly or view it on GitHub: https://github.com/kamailio/kamailio/issues/228#issuecomment-118330590
Hello, I found that his was a problem with db_mode set to 0 I changed db_mode to 1 and everything works. I would still consider this a bug as it causes segfault. Perhaps an error message should be output instead of crashing. Thanks, Emmanuel
--- Reply to this email directly or view it on GitHub: https://github.com/kamailio/kamailio/issues/228#issuecomment-118358503
Pushed the patch f2958e5861a96e40f0aca05d5d5bd7fa14c2089e
Re-open if still and issue.
--- Reply to this email directly or view it on GitHub: https://github.com/kamailio/kamailio/issues/228#issuecomment-122199509
Closed #228.
--- Reply to this email directly or view it on GitHub: https://github.com/kamailio/kamailio/issues/228#event-358252840