<!--
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:
* http://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
If you have questions about developing extensions to Kamailio or its existing C code, ask on sr-dev mailing list:
* http://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev
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
Similar to [issue #1886](https://github.com/kamailio/kamailio/issues/1886), we have Kamailio receiving WebRTC connections from clients and we see many errors related to connections being forcibly closed.
We see two cases where this occurs, the former of which occurs much more often.
```
Dec 29 01:12:43.909934 tlx-dal-ecv2-staging kamailio_edge[14813]: WARNING: websocket [ws_frame.c:810]: ws_keepalive(): forcibly closing connection
Dec 29 01:12:43.910179 tlx-dal-ecv2-staging kamailio_edge[14813]: ERROR: websocket [ws_conn.c:375]: wsconn_close_now(): getting TCP/TLS connection while trying to close. src_ip:src_port=x.x.x.x:49319, dst_port=443
```
```
Dec 29 00:53:28.110949 tlx-dal-ecv2-staging kamailio_edge[14817]: WARNING: websocket [ws_frame.c:227]: encode_and_send_ws_frame(): TCP/TLS connection get failed
Dec 29 00:53:28.111187 tlx-dal-ecv2-staging kamailio_edge[14817]: ERROR: websocket [ws_frame.c:761]: ping_pong(): sending keepalive. src_ip:src_port=x.x.x.x:46712, dst_port=443
```
### Troubleshooting
There seems to be a common occurrence where the WebSocket keepalive will not receive a pong and close the websocket connection. While closing, we see that the underlying TCP connection has already been closed. While that may be harmless, I am concerned there is a race condition that could lead to other problems.
### Additional Information
* **Kamailio Version** - output of `kamailio -v`
```
version: kamailio 5.3.1 (x86_64/linux) d68f5c
flags: USE_TCP, USE_TLS, USE_SCTP, TLS_HOOKS, USE_RAW_SOCKS, DISABLE_NAGLE, USE_MCAST, DNS_IP_HACK, 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, TLS_PTHREAD_MUTEX_SHARED
ADAPTIVE_WAIT_LOOPS 1024, MAX_RECV_BUFFER_SIZE 262144, MAX_URI_SIZE 1024, BUF_SIZE 65535, DEFAULT PKG_SIZE 8MB
poll method support: poll, epoll_lt, epoll_et, sigio_rt, select.
id: d68f5c
compiled on 07:32:16 Dec 29 2021 with gcc 8.3.0
```
* **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`)
-->
```
> lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 10 (buster)
Release: 10
Codename: buster
> uname -a
Linux tlx-dal-ecv2-staging 4.19.0-8-amd64 #1 SMP Debian 4.19.98-1 (2020-01-26) x86_64 GNU/Linux
```
--
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/2990
You are receiving this because you are subscribed to this thread.
Message ID: <kamailio/kamailio/issues/2990(a)github.com>
The kafka module use printf-like message to print statistics in rpc_kafka_stats() which doesn't follow the style for other RPC commands that produce data structures parsable as data, like when using jsonrpc.
```
if (rpc->rpl_printf(ctx, "Total messages: %" PRIu64 " Errors: %" PRIu64,
msg_total, msg_error) < 0) {
rpc->fault(ctx, 500, "Internal error showing total statistics");
return;
}
```
I think this is a bug, but easy to fix.
--
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/2991
You are receiving this because you are subscribed to this thread.
Message ID: <kamailio/kamailio/issues/2991(a)github.com>
### Description
We are trying to use CNXCC in order to monitor credit usage but it doesn't appear to be working.
The cnxcc_set_max_credit call appears to be working partially as we can see that a new key is created in the Redis DB but with all the values set to 0.
The values that we set in the cnxcc_set_max_credit are hardcoded but it doesn't seem to work.
This is an example of what we find in the Redis DB:
```
1637599472.872820 [1 127.0.0.1:53578] "HEXISTS" "cnxcc:money:pippo@dom.domain.it" "concurrent_calls"
1637599472.872942 [1 127.0.0.1:53578] "EXPIRE" "cnxcc:money:pippo@dom.domain.it" "70"
1637599472.873043 [1 127.0.0.1:53578] "HSET" "cnxcc:money:pippo@dom.domain.it" "concurrent_calls" "0"
1637599472.873159 [1 127.0.0.1:53578] "EXPIRE" "cnxcc:money:pippo@dom.domain.it" "70"
1637599472.873292 [1 127.0.0.1:53578] "HSET" "cnxcc:money:pippo@dom.domain.it" "consumed_amount" "0.000000"
1637599472.873404 [1 127.0.0.1:53578] "EXPIRE" "cnxcc:money:pippo@dom.domain.it" "70"
1637599472.873515 [1 127.0.0.1:53578] "HSET" "cnxcc:money:pippo@dom.domain.it" "ended_calls_consumed_amount" "0.000000"
1637599472.873634 [1 127.0.0.1:53578] "EXPIRE" "cnxcc:money:pippo@dom.domain.it" "70"
1637599472.873752 [1 127.0.0.1:53578] "HSET" "cnxcc:money:pippo@dom.domain.it" "max_amount" "0.000000"
1637599472.873875 [1 127.0.0.1:53578] "EXPIRE" "cnxcc:money:pippo@dom.domain.it" "70"
1637599472.874000 [1 127.0.0.1:53578] "HSET" "cnxcc:money:pippo@dom.domain.it" "number_of_calls" "0"
1637599472.874115 [1 127.0.0.1:53578] "EXPIRE" "cnxcc:money:pippo@dom.domain.it" "70"
1637599472.874269 [1 127.0.0.1:53578] "HSET" "cnxcc:money:pippo@dom.domain.it" "type" "1"
1637599472.874381 [1 127.0.0.1:53578] "EXPIRE" "cnxcc:money:pippo@dom.domain.it" "70"
1637599472.874481 [1 127.0.0.1:53578] "SREM" "cnxcc:kill_list:money" "\"pippo(a)dom.domain.it\""
1637599472.874585 [1 127.0.0.1:53578] "EXPIRE" "cnxcc:money:pippo@dom.domain.it" "70"
1637599472.874747 [1 127.0.0.1:53578] "HINCRBY" "cnxcc:money:pippo@dom.domain.it" "number_of_calls" "1"
1637599472.874845 [1 127.0.0.1:53578] "EXPIRE" "cnxcc:money:pippo@dom.domain.it" "70"
```
This issue is identical to the one described in #1387
### Troubleshooting
#### Reproduction
We are running Kamailio 5.5 from the official repos on Debian 10. All the modules are installed through the repo.
This is the config that we are currently using to set the values for the modules.
We also tried setting the values straight into the function bypassing the variables but the result is the same.
```
$dlg_var(credit) = "50.0";
$var(connect_cost) = "5.0";
$var(cost_per_sec) = "1.0";
$var(i_pulse) = 1;
$var(f_pulse) = 1;
xlog("$dlg_var(label) $var(credit) $var(connect_cost) ");
if (cnxcc_set_max_credit("$dlg_var(label)", "$dlg_var(credit)", "$var(connect_cost)", "$var(cost_per_sec)", "$var(i_pulse) ", "$var(f_pulse)") < 0) {
xlog("Failed to setup credit control");
sl_send_reply("503", "Internal Server Error");
exit;
}
```
#### Log Messages
The call to cnxcc_set_max_credit() doesn't throw any errors and returns 1 as if everything worked correctly
### Additional Information
* **Kamailio Version** - output of `kamailio -v`
```
version: kamailio 5.5.2 (x86_64/linux)
flags: USE_TCP, USE_TLS, USE_SCTP, TLS_HOOKS, USE_RAW_SOCKS, DISABLE_NAGLE, USE_MCAST, DNS_IP_HACK, 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_BLOCKLIST, HAVE_RESOLV_RES, TLS_PTHREAD_MUTEX_SHARED
ADAPTIVE_WAIT_LOOPS 1024, MAX_RECV_BUFFER_SIZE 262144, 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 8.3.0
```
* **Operating System**:
```
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 10 (buster)
Release: 10
Codename: buster
Linux kamailio 5.11.22-5-pve #1 SMP PVE 5.11.22-10 (Tue, 28 Sep 2021 08:15:41 +0200) x86_64 GNU/Linux
```
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/2948
<!--
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:
* http://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
If you have questions about developing extensions to Kamailio or its existing C code, ask on sr-dev mailing list:
* http://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev
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
Found following issue when trying to solve #2895 :
<!--
Explain what you did, what you expected to happen, and what actually happened.
-->
function kazoo_query (as shown in the module's documentation) causes kamailio to crash.
### Troubleshooting
#### Reproduction
Compile kamailio master-branch from scratch (with module "kazoo" enabled).
Modify kamailio-config with minimal settings required to use function "kazoo_query":
```
diff /usr/local/etc/kamailio/kamailio.cfg.sample /usr/local/etc/kamailio/kamailio.cfg
496a497,501
> loadmodule "kazoo.so"
> modparam("kazoo", "amqp_connection", "amqp://guest:guest@rabbitmqhost:5672")
> modparam("kazoo", "node_hostname", "sipproxy.mydomain.com")
> modparam("kazoo", "pua_mode", 0)
>
517a523,533
> xlog("SCRIPT: Snipppet from kazoo_query-documentation:\n");
> $var(amqp_payload_request) = "{'Event-Category' : 'call_event' , 'Event-Name' : 'query_user_channels_req', 'Realm' : '" + $fd + "', 'Username' : '" + $fU + "', 'Active-Only' : false }";
> kazoo_encode("$ci", "$var(callid_encoded)");
> $var(amqp_routing_key) = "call.status_req.$var(callid_encoded)";
> if(kazoo_query("callevt", $var(amqp_routing_key), $var(amqp_payload_request), "$var(amqp_result)")) {
> kazoo_json("$var(amqp_result)", "Channels[0].switch_url", "$du");
> if($du != $null) {
> xlog("L_INFO", "$ci|log|user channels found redirecting call to $du");
> return;
> }
> }
```
Start kamailio and register. Kamailio crashes when reaching kazoo_query:
```
Nov 6 16:19:37 hostname kamailio: INFO: <core> [core/tcp_main.c:4997]: init_tcp(): using epoll_lt as the io watch method (auto detected)
Nov 6 16:19:37 hostname src/kamailio[352171]: INFO: rr [../outbound/api.h:52]: ob_load_api(): unable to import bind_ob - maybe module is not loaded
Nov 6 16:19:37 hostname src/kamailio[352171]: INFO: rr [rr_mod.c:188]: mod_init(): outbound module not available
Nov 6 16:19:37 hostname src/kamailio[352171]: INFO: <core> [main.c:3035]: main(): processes (at least): 52 - shm size: 67108864 - pkg size: 8388608
Nov 6 16:19:37 hostname src/kamailio[352171]: INFO: <core> [core/udp_server.c:154]: probe_max_receive_buffer(): SO_RCVBUF is initially 212992
Nov 6 16:19:37 hostname src/kamailio[352171]: INFO: <core> [core/udp_server.c:206]: probe_max_receive_buffer(): SO_RCVBUF is finally 425984
Nov 6 16:19:37 hostname src/kamailio[352171]: INFO: <core> [core/udp_server.c:154]: probe_max_receive_buffer(): SO_RCVBUF is initially 212992
Nov 6 16:19:37 hostname src/kamailio[352171]: INFO: <core> [core/udp_server.c:206]: probe_max_receive_buffer(): SO_RCVBUF is finally 425984
Nov 6 16:19:37 hostname src/kamailio[352171]: INFO: <core> [core/udp_server.c:154]: probe_max_receive_buffer(): SO_RCVBUF is initially 212992
Nov 6 16:19:37 hostname src/kamailio[352171]: INFO: <core> [core/udp_server.c:206]: probe_max_receive_buffer(): SO_RCVBUF is finally 425984
Nov 6 16:19:37 hostname src/kamailio[352200]: INFO: jsonrpcs [jsonrpcs_sock.c:443]: jsonrpc_dgram_process(): a new child 0/352200
Nov 6 16:19:37 hostname src/kamailio[352202]: INFO: ctl [io_listener.c:213]: io_listen_loop(): io_listen_loop: using epoll_lt io watch method (config)
Nov 6 16:19:37 hostname src/kamailio[352203]: ERROR: kazoo [kz_amqp.c:2387]: kz_amqp_consumer_event_cfg(): kazoo:consumer-event not found
Nov 6 16:19:42 hostname src/kamailio[352203]: ERROR: kazoo [kz_amqp.c:2387]: kz_amqp_consumer_event_cfg(): kazoo:consumer-event not found
Nov 6 16:19:49 hostname src/kamailio[352213]: ERROR: {1 1 REGISTER OUfeIVS08Xrbmw8Nr-udtg..} <script>: SCRIPT: Snipppet from kazoo_query-documentation:
Nov 6 16:19:49 hostname src/kamailio[352221]: CRITICAL: <core> [core/pass_fd.c:277]: receive_fd(): EOF on 72
Nov 6 16:19:49 hostname src/kamailio[352171]: ALERT: <core> [main.c:774]: handle_sigs(): child process 352213 exited by a signal 6
Nov 6 16:19:49 hostname src/kamailio[352171]: ALERT: <core> [main.c:777]: handle_sigs(): core was generated
Nov 6 16:19:49 hostname src/kamailio[352171]: INFO: <core> [main.c:799]: handle_sigs(): terminating due to SIGCHLD
Nov 6 16:19:49 hostname src/kamailio[352220]: INFO: <core> [main.c:854]: sig_usr(): signal 15 received
Nov 6 16:19:49 hostname src/kamailio[352218]: INFO: <core> [main.c:854]: sig_usr(): signal 15 received
Nov 6 16:19:49 hostname src/kamailio[352209]: INFO: <core> [main.c:854]: sig_usr(): signal 15 received
Nov 6 16:19:49 hostname src/kamailio[352219]: INFO: <core> [main.c:854]: sig_usr(): signal 15 received
Nov 6 16:19:49 hostname src/kamailio[352201]: INFO: <core> [main.c:854]: sig_usr(): signal 15 received
Nov 6 16:19:49 hostname src/kamailio[352187]: INFO: <core> [main.c:854]: sig_usr(): signal 15 received
Nov 6 16:19:49 hostname src/kamailio[352207]: INFO: <core> [main.c:854]: sig_usr(): signal 15 received
Nov 6 16:19:49 hostname src/kamailio[352205]: INFO: <core> [main.c:854]: sig_usr(): signal 15 received
Nov 6 16:19:49 hostname src/kamailio[352202]: INFO: <core> [main.c:854]: sig_usr(): signal 15 received
Nov 6 16:19:49 hostname src/kamailio[352199]: INFO: <core> [main.c:854]: sig_usr(): signal 15 received
Nov 6 16:19:49 hostname src/kamailio[352195]: INFO: <core> [main.c:854]: sig_usr(): signal 15 received
Nov 6 16:19:49 hostname src/kamailio[352210]: INFO: <core> [main.c:854]: sig_usr(): signal 15 received
Nov 6 16:19:49 hostname src/kamailio[352193]: INFO: <core> [main.c:854]: sig_usr(): signal 15 received
Nov 6 16:19:49 hostname src/kamailio[352196]: INFO: <core> [main.c:854]: sig_usr(): signal 15 received
Nov 6 16:19:49 hostname src/kamailio[352183]: INFO: <core> [main.c:854]: sig_usr(): signal 15 received
Nov 6 16:19:49 hostname src/kamailio[352191]: INFO: <core> [main.c:854]: sig_usr(): signal 15 received
Nov 6 16:19:49 hostname src/kamailio[352176]: INFO: <core> [main.c:854]: sig_usr(): signal 15 received
Nov 6 16:19:49 hostname src/kamailio[352203]: INFO: <core> [main.c:854]: sig_usr(): signal 15 received
Nov 6 16:19:49 hostname src/kamailio[352189]: INFO: <core> [main.c:854]: sig_usr(): signal 15 received
Nov 6 16:19:49 hostname src/kamailio[352192]: INFO: <core> [main.c:854]: sig_usr(): signal 15 received
Nov 6 16:19:49 hostname src/kamailio[352175]: INFO: <core> [main.c:854]: sig_usr(): signal 15 received
Nov 6 16:19:49 hostname src/kamailio[352208]: INFO: <core> [main.c:854]: sig_usr(): signal 15 received
Nov 6 16:19:49 hostname src/kamailio[352185]: INFO: <core> [main.c:854]: sig_usr(): signal 15 received
Nov 6 16:19:49 hostname src/kamailio[352182]: INFO: <core> [main.c:854]: sig_usr(): signal 15 received
Nov 6 16:19:49 hostname src/kamailio[352216]: INFO: <core> [main.c:854]: sig_usr(): signal 15 received
Nov 6 16:19:49 hostname src/kamailio[352190]: INFO: <core> [main.c:854]: sig_usr(): signal 15 received
Nov 6 16:19:49 hostname src/kamailio[352206]: INFO: <core> [main.c:854]: sig_usr(): signal 15 received
Nov 6 16:19:49 hostname src/kamailio[352194]: INFO: <core> [main.c:854]: sig_usr(): signal 15 received
Nov 6 16:19:49 hostname src/kamailio[352177]: INFO: <core> [main.c:854]: sig_usr(): signal 15 received
Nov 6 16:19:49 hostname src/kamailio[352215]: INFO: <core> [main.c:854]: sig_usr(): signal 15 received
Nov 6 16:19:49 hostname src/kamailio[352186]: INFO: <core> [main.c:854]: sig_usr(): signal 15 received
Nov 6 16:19:49 hostname src/kamailio[352173]: INFO: <core> [main.c:854]: sig_usr(): signal 15 received
Nov 6 16:19:49 hostname src/kamailio[352204]: INFO: <core> [main.c:854]: sig_usr(): signal 15 received
Nov 6 16:19:49 hostname src/kamailio[352184]: INFO: <core> [main.c:854]: sig_usr(): signal 15 received
Nov 6 16:19:49 hostname src/kamailio[352188]: INFO: <core> [main.c:854]: sig_usr(): signal 15 received
Nov 6 16:19:49 hostname src/kamailio[352217]: INFO: <core> [main.c:854]: sig_usr(): signal 15 received
Nov 6 16:19:49 hostname src/kamailio[352214]: INFO: <core> [main.c:854]: sig_usr(): signal 15 received
Nov 6 16:19:49 hostname src/kamailio[352180]: INFO: <core> [main.c:854]: sig_usr(): signal 15 received
Nov 6 16:19:49 hostname src/kamailio[352198]: INFO: <core> [main.c:854]: sig_usr(): signal 15 received
Nov 6 16:19:49 hostname src/kamailio[352172]: INFO: <core> [main.c:854]: sig_usr(): signal 15 received
Nov 6 16:19:49 hostname src/kamailio[352221]: INFO: <core> [main.c:854]: sig_usr(): signal 15 received
Nov 6 16:19:49 hostname src/kamailio[352174]: INFO: <core> [main.c:854]: sig_usr(): signal 15 received
Nov 6 16:19:49 hostname src/kamailio[352197]: INFO: <core> [main.c:854]: sig_usr(): signal 15 received
Nov 6 16:19:49 hostname src/kamailio[352200]: INFO: <core> [main.c:854]: sig_usr(): signal 15 received
Nov 6 16:19:49 hostname src/kamailio[352211]: INFO: <core> [main.c:854]: sig_usr(): signal 15 received
Nov 6 16:19:49 hostname src/kamailio[352212]: INFO: <core> [main.c:854]: sig_usr(): signal 15 received
Nov 6 16:19:49 hostname src/kamailio[352181]: INFO: <core> [main.c:854]: sig_usr(): signal 15 received
Nov 6 16:19:49 hostname src/kamailio[352179]: INFO: <core> [main.c:854]: sig_usr(): signal 15 received
Nov 6 16:19:49 hostname src/kamailio[352178]: INFO: <core> [main.c:854]: sig_usr(): signal 15 received
Nov 6 16:19:49 hostname src/kamailio[352171]: INFO: <core> [core/sctp_core.c:53]: sctp_core_destroy(): SCTP API not initialized
```
#### 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.
-->
backtrace with gdb shows:
```
(gdb) bt
#0 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
#1 0x00007fc47407a859 in __GI_abort () at abort.c:79
#2 0x00007fc47407a729 in __assert_fail_base (fmt=0x7fc474210588 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n",
assertion=0x7fc46f0fe2d0 "json_object_get_type(jso) == json_type_object", file=0x7fc46f0fe044 "json_object.c", line=476, function=<optimized out>) at assert.c:92
#3 0x00007fc47408bf36 in __GI___assert_fail (assertion=0x7fc46f0fe2d0 "json_object_get_type(jso) == json_type_object", file=0x7fc46f0fe044 "json_object.c", line=476,
function=0x7fc46f0fe280 "json_object_object_add_ex") at assert.c:101
#4 0x00007fc46f0f7d26 in json_object_object_add_ex () from /lib/x86_64-linux-gnu/libjson-c.so.4
#5 0x00007fc46f14ebe4 in kz_amqp_add_payload_common_properties (json_obj=0x559b3c3b30c0, server_id=0x7ffda57606f0 "kamailio(a)sipproxy.mydomain.com-<352213>-script-0",
unique=0x7ffda5760660) at kz_amqp.c:1023
#6 0x00007fc46f1509a0 in kz_amqp_pipe_send_receive (str_exchange=0x7ffda57609c0, str_routing_key=0x7ffda57609d0, str_payload=0x7ffda57609b0, kz_timeout=0x7ffda57609e0,
json_ret=0x7ffda5760a10) at kz_amqp.c:1159
#7 0x00007fc46f158763 in kz_amqp_query_ex (msg=0x7fc47394beb8, exchange=0x7fc4738f03d0 "(q\216s\304\177", routing_key=0x7fc4738f57c8 "0\213\207s\304\177",
payload=0x7fc4738f58d8 "hX\217s\304\177") at kz_amqp.c:1494
#8 0x00007fc46f1588b2 in kz_amqp_query (msg=0x7fc47394beb8, exchange=0x7fc4738f03d0 "(q\216s\304\177", routing_key=0x7fc4738f57c8 "0\213\207s\304\177",
payload=0x7fc4738f58d8 "hX\217s\304\177", dst=0x7fc4738f04f0 "p\004\217s\304\177") at kz_amqp.c:1517
#9 0x0000559b3b1c7355 in do_action (h=0x7ffda5761370, a=0x7fc4738f1d98, msg=0x7fc47394beb8) at core/action.c:1151
#10 0x0000559b3b1d0463 in run_actions (h=0x7ffda5761370, a=0x7fc4738f1d98, msg=0x7fc47394beb8) at core/action.c:1581
#11 0x0000559b3b1d0bd6 in run_actions_safe (h=0x7ffda5761f70, a=0x7fc4738f1d98, msg=0x7fc47394beb8) at core/action.c:1645
#12 0x0000559b3b16a4b0 in rval_get_int (h=0x7ffda5761f70, msg=0x7fc47394beb8, i=0x7ffda5761750, rv=0x7fc4738f4040, cache=0x0) at core/rvalue.c:949
#13 0x0000559b3b16fa9c in rval_expr_eval_int (h=0x7ffda5761f70, msg=0x7fc47394beb8, res=0x7ffda5761750, rve=0x7fc4738f4038) at core/rvalue.c:1947
#14 0x0000559b3b1c0ec8 in do_action (h=0x7ffda5761f70, a=0x7fc4738f7f28, msg=0x7fc47394beb8) at core/action.c:1052
#15 0x0000559b3b1d0463 in run_actions (h=0x7ffda5761f70, a=0x7fc4738e8ca8, msg=0x7fc47394beb8) at core/action.c:1581
#16 0x0000559b3b1d0ce6 in run_top_route (a=0x7fc4738e8ca8, msg=0x7fc47394beb8, c=0x0) at core/action.c:1666
#17 0x0000559b3b37f932 in receive_msg (
buf=0x559b3c3a0960 "REGISTER sip:10.0.0.24:5060;transport=TCP SIP/2.0\r\nVia: SIP/2.0/TCP 10.0.0.33:47335;branch=z9hG4bK-524287-1---83d016a408b857dd;rport\r\nMax-Forwards: 69\r\nContact: <sip:1234@10.0.0.33:47335;rinstance=837"..., len=578, rcv_info=0x7fc46f4c01a8) at core/receive.c:513
#18 0x0000559b3b41dfb3 in receive_tcp_msg (
tcpbuf=0x7fc46f4c0530 "REGISTER sip:10.0.0.24:5060;transport=TCP SIP/2.0\r\nVia: SIP/2.0/TCP 10.0.0.33:47335;branch=z9hG4bK-524287-1---83d016a408b857dd;rport\r\nMax-Forwards: 70\r\nContact: <sip:1234@10.0.0.33:47335;rinstance=837"..., len=578, rcv_info=0x7fc46f4c01a8, con=0x7fc46f4c0190) at core/tcp_read.c:1424
#19 0x0000559b3b4205f8 in tcp_read_req (con=0x7fc46f4c0190, bytes_read=0x7ffda5762618, read_flags=0x7ffda576261c) at core/tcp_read.c:1607
#20 0x0000559b3b423af5 in handle_io (fm=0x7fc473954a08, events=1, idx=-1) at core/tcp_read.c:1782
#21 0x0000559b3b40eccc in io_wait_loop_epoll (h=0x559b3b6f62e0 <io_w>, t=2, repeat=0) at core/io_wait.h:1070
#22 0x0000559b3b426aa8 in tcp_receive_loop (unix_sock=75) at core/tcp_read.c:1978
#23 0x0000559b3b2a161e in tcp_init_children (woneinit=0x7ffda5762a00) at core/tcp_main.c:5153
#24 0x0000559b3b153f0b in main_loop () at main.c:1843
#25 0x0000559b3b15e745 in main (argc=1, argv=0x7ffda57630e8) at main.c:3058
```
#### 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).
-->
#### 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
This somehow pointed me to the payload - so I tried to change the AMQP-payload in the config to a minimalistic custom JSON document. With this config, the crash does no longer occur:
```
diff /usr/local/etc/kamailio/kamailio.cfg /usr/local/etc/kamailio/kamailio.cfg.sample
497,501d496
< loadmodule "kazoo.so"
< modparam("kazoo", "amqp_connection", "amqp://guest:guest@guest@rabbitmqhost:5672")
< modparam("kazoo", "node_hostname", "sipproxy.mydomain.com")
< modparam("kazoo", "pua_mode", 0)
<
523,533d517
< xlog("SCRIPT: Snipppet from kazoo_query-documentation:\n");
< #$var(amqp_payload_request) = "{'Event-Category' : 'call_event' , 'Event-Name' : 'query_user_channels_req', 'Realm' : '" + $fd + "', 'Username' : '" + $fU + "', 'Active-Only' : false }";
< kazoo_encode("$ci", "$var(callid_encoded)");
< $var(amqp_routing_key) = "call.status_req.$var(callid_encoded)";
< if(kazoo_query("callevt", $var(amqp_routing_key), "{\"blop\":\"example\"}", "$var(amqp_result)")) {
< kazoo_json("$var(amqp_result)", "Channels[0].switch_url", "$du");
< if($du != $null) {
< xlog("L_INFO", "$ci|log|user channels found redirecting call to $du");
< return;
< }
< }
```
So, some issue in the exmaple's payload causes the crash. One the one hand, I think an example from the documentation should somehow work, on the other hand I think that an error in a JSON-payload is not indended to crash kamailio anyway.
<!--
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 -v
version: kamailio 5.6.0-dev2 (x86_64/linux) 63a349
flags: USE_TCP, USE_TLS, USE_SCTP, TLS_HOOKS, USE_RAW_SOCKS, DISABLE_NAGLE, USE_MCAST, DNS_IP_HACK, 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_BLOCKLIST, HAVE_RESOLV_RES, TLS_PTHREAD_MUTEX_SHARED
ADAPTIVE_WAIT_LOOPS 1024, MAX_RECV_BUFFER_SIZE 262144, MAX_URI_SIZE 1024, BUF_SIZE 65535, DEFAULT PKG_SIZE 8MB
poll method support: poll, epoll_lt, epoll_et, sigio_rt, select.
id: 63a349
compiled on 16:12:36 Nov 6 2021 with gcc 9.3.0
```
* **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`)
-->
```
uname -a
Linux hostname 5.11.0-38-generic #42~20.04.1-Ubuntu SMP Tue Sep 28 20:41:07 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 20.04.3 LTS
Release: 20.04
Codename: focal
```
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/2922
<!--
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:
* http://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
If you have questions about developing extensions to Kamailio or its existing C code, ask on sr-dev mailing list:
* http://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev
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
Kamailio's ims_usrloc_pcscf module fetches all contact informations from location table at startup.
I noticed that it fails to fetch protocol information. I checked the function which reads the contact row:
https://github.com/kamailio/kamailio/blob/c3629f877500373028d2c7cdefd976cdd…
I saw that it is read the value as INT. Then checked database table and saw that protocol field is CHAR(5).
https://github.com/kamailio/kamailio/blob/master/utils/kamctl/mysql/ims_usr…
```
CREATE TABLE `location` (
...
`protocol` char(5) DEFAULT NULL,
...
);
```
The protocol fields needs to be INT in location table as well.
This bug leads to other bugs because protocol information is used in aor_hash calculation.
Best regards
Erhan Sendag
### Troubleshooting
#### Reproduction
Put a record in location table with protocol value as 1.
Set ims_usrloc_pcscf module parameter db_mode as 1.
After kamailio startup, on debug log, protocol information will be seen as a big integer value.
#### 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.
-->
```
(paste your debugging data here)
```
#### 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.
-->
The protocol fields can be defined as INT in location table.
### Additional Information
* **Kamailio Version** - output of `kamailio -v`
```
(paste your output here)
```
* **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`)
-->
```
(paste your output here)
```
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/2871
<!--
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:
* http://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
If you have questions about developing extensions to Kamailio or its existing C code, ask on sr-dev mailing list:
* http://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev
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
Hi, I am a junior with Kamailio, if I show you where I am wrong, I will. Often during a call between two sip clients (located on the same subnet with pcscf) Kamailio P-CSCF crashes with a core dump. But sometimes the call goes through normally, I can’t see why this is happening.
<!--
-->
### Troubleshooting
#### Reproduction
It is reproduced often, the error is most likely somewhere with me.
<!--
-->
#### 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.
-->
```
GNU gdb (Debian 10.1-1.7) 10.1.90.20210103-git
Copyright (C) 2021 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 "i686-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /usr/sbin/kamailio...
(No debugging symbols found in /usr/sbin/kamailio)
warning: Can't open file /dev/zero (deleted) during file-backed mapping note processing
[New LWP 14196]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/i386-linux-gnu/libthread_db.so.1".
Core was generated by `/usr/sbin/kamailio -P /run/kamailio/kamailio.pid -f /etc/kamailio/kamailio.cfg'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0 0xb6f1eab9 in ?? () from /usr/lib/i386-linux-gnu/kamailio/modules/ims_ipsec_pcscf.so
(gdb) bt full
#0 0xb6f1eab9 in ?? () from /usr/lib/i386-linux-gnu/kamailio/modules/ims_ipsec_pcscf.so
No symbol table info available.
#1 0xb6f25b1e in ipsec_forward () from /usr/lib/i386-linux-gnu/kamailio/modules/ims_ipsec_pcscf.so
No symbol table info available.
#2 0xb6f2901a in ?? () from /usr/lib/i386-linux-gnu/kamailio/modules/ims_ipsec_pcscf.so
No symbol table info available.
#3 0x004bc49d in do_action ()
No symbol table info available.
#4 0x004bae10 in run_actions ()
No symbol table info available.
#5 0x004ca3a0 in run_top_route ()
No symbol table info available.
#6 0xb73c1695 in reply_received () from /usr/lib/i386-linux-gnu/kamailio/modules/tm.so
No symbol table info available.
#7 0x0052fa14 in ?? ()
No symbol table info available.
#8 0x005b9170 in receive_msg ()
No symbol table info available.
#9 0x006bb830 in udp_rcv_loop ()
No symbol table info available.
#10 0x004b74e8 in main_loop ()
No symbol table info available.
#11 0x004ab0f1 in main ()
No symbol table info available.
```
#### 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).
-->
```
Dec 10 15:33:07 pcscf /usr/sbin/kamailio[14194]: ERROR: rtpengine [rtpengine.c:2957]: select_rtpp_set(): script error-invalid id_set to be selected
Dec 10 15:33:07 pcscf /usr/sbin/kamailio[14194]: ERROR: rtpengine [rtpengine.c:3236]: set_rtpengine_set_from_avp(): could not locate engine set 2
Dec 10 15:35:14 pcscf /usr/sbin/kamailio[14204]: ERROR: <script>: INVITE (sip:bob@ims.mnc001.mcc001.3gppnetwork.org (192.168.56.1:55149) to sip:alice@ims.mnc001.mcc001.3gppnetwork.org, dca98f98-8bb9-c01d-ff0c-e55794e9bcaa)
Dec 10 15:35:14 pcscf /usr/sbin/kamailio[14204]: ERROR: ims_ipsec_pcscf [cmd.c:806]: ipsec_forward(): Contact doesn't exist
Dec 10 15:35:14 pcscf /usr/sbin/kamailio[14204]: ERROR: ims_ipsec_pcscf [cmd.c:806]: ipsec_forward(): Contact doesn't exist
Dec 10 15:35:14 pcscf /usr/sbin/kamailio[14193]: ERROR: ims_ipsec_pcscf [cmd.c:816]: ipsec_forward(): No security parameters found in contact
Dec 10 15:35:14 pcscf /usr/sbin/kamailio[14195]: ERROR: <script>: INVITE (sip:bob@ims.mnc001.mcc001.3gppnetwork.org (192.168.56.106:6060) to sip:alice@ims.mnc001.mcc001.3gppnetwork.org, dca98f98-8bb9-c01d-ff0c-e55794e9bcaa)
Dec 10 15:35:14 pcscf /usr/sbin/kamailio[14195]: ERROR: ims_ipsec_pcscf [cmd.c:816]: ipsec_forward(): No security parameters found in contact
Dec 10 15:35:14 pcscf /usr/sbin/kamailio[14195]: ERROR: ims_ipsec_pcscf [cmd.c:816]: ipsec_forward(): No security parameters found in contact
Dec 10 15:35:14 pcscf /usr/sbin/kamailio[14195]: ERROR: rtpengine [rtpengine.c:2957]: select_rtpp_set(): script error-invalid id_set to be selected
Dec 10 15:35:14 pcscf /usr/sbin/kamailio[14195]: ERROR: rtpengine [rtpengine.c:3236]: set_rtpengine_set_from_avp(): could not locate engine set 2
Dec 10 15:35:14 pcscf /usr/sbin/kamailio[14205]: ERROR: rtpengine [rtpengine.c:2957]: select_rtpp_set(): script error-invalid id_set to be selected
Dec 10 15:35:14 pcscf /usr/sbin/kamailio[14205]: ERROR: rtpengine [rtpengine.c:3236]: set_rtpengine_set_from_avp(): could not locate engine set 2
Dec 10 15:35:14 pcscf /usr/sbin/kamailio[14210]: ERROR: ims_ipsec_pcscf [cmd.c:252]: fill_contact(): Reply No contact headers
Dec 10 15:35:14 pcscf /usr/sbin/kamailio[14210]: ERROR: ims_ipsec_pcscf [cmd.c:799]: ipsec_forward(): Error filling in contact data
Dec 10 15:35:14 pcscf /usr/sbin/kamailio[14201]: ERROR: rtpengine [rtpengine.c:2957]: select_rtpp_set(): script error-invalid id_set to be selected
Dec 10 15:35:14 pcscf /usr/sbin/kamailio[14201]: ERROR: rtpengine [rtpengine.c:3236]: set_rtpengine_set_from_avp(): could not locate engine set 2
Dec 10 15:35:14 pcscf /usr/sbin/kamailio[14274]: CRITICAL: <core> [core/pass_fd.c:277]: receive_fd(): EOF on 22
Dec 10 15:35:14 pcscf /usr/sbin/kamailio[14191]: ALERT: <core> [main.c:782]: handle_sigs(): child process 14196 exited by a signal 11
Dec 10 15:35:14 pcscf /usr/sbin/kamailio[14191]: ALERT: <core> [main.c:785]: handle_sigs(): core was generated
Dec 10 15:35:15 pcscf /usr/sbin/kamailio[14324]: WARNING: <core> [core/daemonize.c:596]: mem_lock_pages(): failed to lock the memory pages (disable swap): Cannot allocate memory [12]
Dec 10 15:35:15 pcscf /usr/sbin/kamailio[14324]: ERROR: rtpengine [rtpengine.c:2957]: select_rtpp_set(): script error-invalid id_set to be selected
Dec 10 15:35:15 pcscf /usr/sbin/kamailio[14324]: WARNING: tm [tm.c:521]: fixup_routes(): t_on_failure("NATMANAGE"): empty/non existing route
Dec 10 15:35:15 pcscf /usr/sbin/kamailio[14324]: ERROR: <script>: event_route[htable:mod-init] {
Dec 10 15:35:15 pcscf /usr/sbin/kamailio[14324]: ERROR: ims_ipsec_pcscf [cmd.c:950]: ipsec_destroy(): Contact doesn't exist
Dec 10 15:35:15 pcscf /usr/sbin/kamailio[14400]: WARNING: ims_usrloc_pcscf [usrloc_db.c:67]: connect_db(): DB connection already open... continuing
Dec 10 15:35:15 pcscf /usr/sbin/kamailio[14406]: WARNING: ims_usrloc_pcscf [usrloc_db.c:67]: connect_db(): DB connection already open... continuing
Dec 10 15:35:15 pcscf /usr/sbin/kamailio[14403]: WARNING: ims_usrloc_pcscf [usrloc_db.c:67]: connect_db(): DB connection already open... continuing
Dec 10 15:35:15 pcscf /usr/sbin/kamailio[14405]: WARNING: ims_usrloc_pcscf [usrloc_db.c:67]: connect_db(): DB connection already open... continuing
Dec 10 15:35:15 pcscf /usr/sbin/kamailio[14401]: WARNING: ims_usrloc_pcscf [usrloc_db.c:67]: connect_db(): DB connection already open... continuing
Dec 10 15:35:15 pcscf /usr/sbin/kamailio[14404]: WARNING: ims_usrloc_pcscf [usrloc_db.c:67]: connect_db(): DB connection already open... continuing
Dec 10 15:35:15 pcscf /usr/sbin/kamailio[14402]: WARNING: ims_usrloc_pcscf [usrloc_db.c:67]: connect_db(): DB connection already open... continuing
Dec 10 15:35:15 pcscf /usr/sbin/kamailio[14399]: WARNING: ims_usrloc_pcscf [usrloc_db.c:67]: connect_db(): DB connection already open... continuing
Dec 10 15:35:15 pcscf /usr/sbin/kamailio[14396]: WARNING: ims_usrloc_pcscf [usrloc_db.c:67]: connect_db(): DB connection already open... continuing
Dec 10 15:35:15 pcscf /usr/sbin/kamailio[14334]: ERROR: <script>: PRACK (sip:bob@ims.mnc001.mcc001.3gppnetwork.org (192.168.56.1:55149) to sip:alice@ims.mnc001.mcc001.3gppnetwork.org, dca98f98-8bb9-c01d-ff0c-e55794e9bcaa)
Dec 10 15:35:15 pcscf /usr/sbin/kamailio[14334]: ERROR: ims_ipsec_pcscf [cmd.c:816]: ipsec_forward(): No security parameters found in contact
Dec 10 15:35:15 pcscf /usr/sbin/kamailio[14334]: ERROR: ims_ipsec_pcscf [cmd.c:816]: ipsec_forward(): No security parameters found in contact
Dec 10 15:35:15 pcscf /usr/sbin/kamailio[14337]: ERROR: <script>: PRACK (sip:bob@ims.mnc001.mcc001.3gppnetwork.org (192.168.56.106:6060) to sip:alice@ims.mnc001.mcc001.3gppnetwork.org, dca98f98-8bb9-c01d-ff0c-e55794e9bcaa)
Dec 10 15:35:15 pcscf /usr/sbin/kamailio[14337]: ERROR: ims_ipsec_pcscf [cmd.c:816]: ipsec_forward(): No security parameters found in contact
Dec 10 15:35:15 pcscf /usr/sbin/kamailio[14337]: ERROR: ims_ipsec_pcscf [cmd.c:816]: ipsec_forward(): No security parameters found in contact
Dec 10 15:35:15 pcscf /usr/sbin/kamailio[14329]: ERROR: <script>: PRACK (sip:bob@ims.mnc001.mcc001.3gppnetwork.org (192.168.56.1:55149) to sip:alice@ims.mnc001.mcc001.3gppnetwork.org, dca98f98-8bb9-c01d-ff0c-e55794e9bcaa)
Dec 10 15:35:15 pcscf /usr/sbin/kamailio[14329]: ERROR: ims_ipsec_pcscf [cmd.c:816]: ipsec_forward(): No security parameters found in contact
Dec 10 15:35:15 pcscf /usr/sbin/kamailio[14329]: ERROR: ims_ipsec_pcscf [cmd.c:816]: ipsec_forward(): No security parameters found in contact
Dec 10 15:35:15 pcscf /usr/sbin/kamailio[14341]: ERROR: <script>: PRACK (sip:bob@ims.mnc001.mcc001.3gppnetwork.org (192.168.56.106:6060) to sip:alice@ims.mnc001.mcc001.3gppnetwork.org, dca98f98-8bb9-c01d-ff0c-e55794e9bcaa)
Dec 10 15:35:15 pcscf /usr/sbin/kamailio[14341]: ERROR: ims_ipsec_pcscf [cmd.c:816]: ipsec_forward(): No security parameters found in contact
Dec 10 15:35:15 pcscf /usr/sbin/kamailio[14341]: ERROR: ims_ipsec_pcscf [cmd.c:816]: ipsec_forward(): No security parameters found in contact
Dec 10 15:35:17 pcscf /usr/sbin/kamailio[14328]: ERROR: <script>: ACK (sip:bob@ims.mnc001.mcc001.3gppnetwork.org (192.168.56.1:55149) to sip:alice@ims.mnc001.mcc001.3gppnetwork.org, dca98f98-8bb9-c01d-ff0c-e55794e9bcaa)
Dec 10 15:35:17 pcscf /usr/sbin/kamailio[14328]: ERROR: ims_ipsec_pcscf [cmd.c:816]: ipsec_forward(): No security parameters found in contact
Dec 10 15:35:17 pcscf /usr/sbin/kamailio[14328]: ERROR: ims_ipsec_pcscf [cmd.c:816]: ipsec_forward(): No security parameters found in contact
Dec 10 15:35:17 pcscf /usr/sbin/kamailio[14326]: ERROR: <script>: ACK (sip:bob@ims.mnc001.mcc001.3gppnetwork.org (192.168.56.106:6060) to sip:alice@ims.mnc001.mcc001.3gppnetwork.org, dca98f98-8bb9-c01d-ff0c-e55794e9bcaa)
Dec 10 15:35:17 pcscf /usr/sbin/kamailio[14326]: ERROR: ims_ipsec_pcscf [cmd.c:816]: ipsec_forward(): No security parameters found in contact
Dec 10 15:35:17 pcscf /usr/sbin/kamailio[14326]: ERROR: ims_ipsec_pcscf [cmd.c:816]: ipsec_forward(): No security parameters found in contact
Dec 10 15:35:26 pcscf /usr/sbin/kamailio[14327]: ERROR: <script>: BYE (sip:bob@ims.mnc001.mcc001.3gppnetwork.org (192.168.56.1:55149) to sip:alice@ims.mnc001.mcc001.3gppnetwork.org, dca98f98-8bb9-c01d-ff0c-e55794e9bcaa)
Dec 10 15:35:26 pcscf /usr/sbin/kamailio[14327]: ERROR: ims_ipsec_pcscf [cmd.c:816]: ipsec_forward(): No security parameters found in contact
Dec 10 15:35:26 pcscf /usr/sbin/kamailio[14327]: ERROR: ims_ipsec_pcscf [cmd.c:816]: ipsec_forward(): No security parameters found in contact
Dec 10 15:35:26 pcscf /usr/sbin/kamailio[14325]: ERROR: <script>: BYE (sip:bob@ims.mnc001.mcc001.3gppnetwork.org (192.168.56.106:6060) to sip:alice@ims.mnc001.mcc001.3gppnetwork.org, dca98f98-8bb9-c01d-ff0c-e55794e9bcaa)
Dec 10 15:35:26 pcscf /usr/sbin/kamailio[14325]: ERROR: ims_ipsec_pcscf [cmd.c:816]: ipsec_forward(): No security parameters found in contact
Dec 10 15:35:26 pcscf /usr/sbin/kamailio[14325]: ERROR: ims_ipsec_pcscf [cmd.c:816]: ipsec_forward(): No security parameters found in contact
Dec 10 15:35:26 pcscf /usr/sbin/kamailio[14325]: ERROR: rtpengine [rtpengine.c:2957]: select_rtpp_set(): script error-invalid id_set to be selected
Dec 10 15:35:26 pcscf /usr/sbin/kamailio[14325]: ERROR: rtpengine [rtpengine.c:3236]: set_rtpengine_set_from_avp(): could not locate engine set 2
Dec 10 15:35:30 pcscf /usr/sbin/kamailio[14396]: ERROR: <script>: Preloading NAT-PING. Rows: 921
Dec 10 15:35:30 pcscf /usr/sbin/kamailio[14396]: ERROR: <script>: OPTIONS to sip:alice@192.168.56.107:57838;transport=udp via sip:192.168.56.107:57838...
```
#### 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)
```
[pcscf_dump.zip](https://github.com/kamailio/kamailio/files/7692913/pcscf_du…
### 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`
```
version: kamailio 5.4.4 (i386/linux)
flags: USE_TCP, USE_TLS, USE_SCTP, TLS_HOOKS, USE_RAW_SOCKS, DISABLE_NAGLE, USE_MCAST, DNS_IP_HACK, 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, TLS_PTHREAD_MUTEX_SHARED
ADAPTIVE_WAIT_LOOPS 1024, MAX_RECV_BUFFER_SIZE 262144, 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 10.2.1
```
* **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`)
-->
```
Linux pcscf.ims.mnc001.mcc001.3gppnetwork.org 5.10.0-9-686-pae #1 SMP Debian 5.10.70-1 (2021-09-30) i686 GNU/Linux
```
[kamailio_cfg.zip](https://github.com/kamailio/kamailio/files/7692905/kamail…
[kamailio_log.zip](https://github.com/kamailio/kamailio/files/7692934/kamail…
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/2970
<!--
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:
* http://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
If you have questions about developing extensions to Kamailio or its existing C code, ask on sr-dev mailing list:
* http://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev
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
ims_registrar_pcscf module create a process with rank 1 (PROC_SIPINIT) if reginfo flag is open..
This is wrong because it is written that PROC_SIPINIT rank should be given only to the first worker process.
```
#define PROC_SIPINIT 1 /**< First (special) SIP worker - some modules do
special processing in this child, like loading db data */
```
This leads to a problem. ims_usrloc_pcscf loads registration records from the db twice.
The codes are demonstrated below.
Similar old issue exists here for another module:
https://github.com/kamailio/kamailio/issues/975
### Troubleshooting
#### Reproduction
<!--
If the issue can be reproduced, describe how it can be done.
-->
#### 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.
-->
```
(paste your debugging data here)
```
#### 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).
-->
Here are fork operations and their ranks:
```
[root@n5gc-ims-dev src]# cat /usr/src/erhan5.log | grep init_mod_child | grep ims_usrloc_pcscf
0(10662) DEBUG: <core> [core/sr_module.c:845]: init_mod_child(): idx 0 rank -127: ims_usrloc_pcscf [main]
1(10671) DEBUG: <core> [core/sr_module.c:845]: init_mod_child(): idx 1 rank 1: ims_usrloc_pcscf [udp receiver child=0 sock=10.10.12.101:5060 (172.30.65.101:5060)]
3(10673) DEBUG: <core> [core/sr_module.c:845]: init_mod_child(): idx 3 rank 3: ims_usrloc_pcscf [udp receiver child=2 sock=10.10.12.101:5060 (172.30.65.101:5060)]
2(10672) DEBUG: <core> [core/sr_module.c:845]: init_mod_child(): idx 2 rank 2: ims_usrloc_pcscf [udp receiver child=1 sock=10.10.12.101:5060 (172.30.65.101:5060)]
5(10675) DEBUG: <core> [core/sr_module.c:845]: init_mod_child(): idx 5 rank -1: ims_usrloc_pcscf [slow timer]
0(10662) DEBUG: <core> [core/sr_module.c:845]: init_mod_child(): idx 0 rank 0: ims_usrloc_pcscf [main]
6(10679) DEBUG: <core> [core/sr_module.c:845]: init_mod_child(): idx 6 rank -1: ims_usrloc_pcscf [timer]
4(10674) DEBUG: <core> [core/sr_module.c:845]: init_mod_child(): idx 4 rank 4: ims_usrloc_pcscf [udp receiver child=3 sock=10.10.12.101:5060 (172.30.65.101:5060)]
7(10680) DEBUG: <core> [core/sr_module.c:845]: init_mod_child(): idx 7 rank -1: ims_usrloc_pcscf [secondary timer]
8(10686) DEBUG: <core> [core/sr_module.c:845]: init_mod_child(): idx 8 rank 1: ims_usrloc_pcscf [RegInfo Event Processor]
9(10687) DEBUG: <core> [core/sr_module.c:845]: init_mod_child(): idx 9 rank -1: ims_usrloc_pcscf [Dialog Clean Timer]
10(10688) DEBUG: <core> [core/sr_module.c:845]: init_mod_child(): idx 10 rank -2: ims_usrloc_pcscf [ctl handler]
11(10689) DEBUG: <core> [core/sr_module.c:845]: init_mod_child(): idx 11 rank 5: ims_usrloc_pcscf [tcp receiver (generic) child=0]
12(10694) DEBUG: <core> [core/sr_module.c:845]: init_mod_child(): idx 12 rank 6: ims_usrloc_pcscf [tcp receiver (generic) child=1]
13(10695) DEBUG: <core> [core/sr_module.c:845]: init_mod_child(): idx 13 rank 7: ims_usrloc_pcscf [tcp receiver (generic) child=2]
14(10697) DEBUG: <core> [core/sr_module.c:845]: init_mod_child(): idx 14 rank 8: ims_usrloc_pcscf [tcp receiver (generic) child=3]
15(10699) DEBUG: <core> [core/sr_module.c:845]: init_mod_child(): idx 15 rank -4: ims_usrloc_pcscf [tcp main process]
```
#### 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.
-->
In following code ims_registrar_pcscf module create a process with rank 1 (PROC_SIPINIT) :
fork_process(PROC_SIPINIT, "RegInfo Event Processor", 1);
```
static int child_init(int rank)
{
LM_DBG("Initialization of module in child [%d] \n", rank);
if ((subscribe_to_reginfo == 1) && (rank == PROC_MAIN)) {
LM_DBG("Creating RegInfo Event Processor process\n");
int pid = fork_process(PROC_SIPINIT, "RegInfo Event Processor", 1);
if (pid < 0)
return -1; //error
if (pid == 0) {
if (cfg_child_init())
return -1; //error
reginfo_event_process();
}
}
if (rank == PROC_MAIN || rank == PROC_TCP_MAIN)
return 0;
if (rank == 1) {
/* init stats */
//TODO if parameters are modified via cfg framework do i change them?
//update_stat( max_expires_stat, default_registrar_cfg.max_expires ); update_stat( max_contacts_stat, default_registrar_cfg.max_contacts ); update_stat( default_expire_stat, default_registrar_cfg.default_expires );
}
/* don't do anything for main process and TCP manager process */
if (rank == PROC_MAIN || rank == PROC_TCP_MAIN)
return 0;
return 0;
}
```
Here is how ims_usrloc_pcscf loads records from db at its child init callback function:
```
if (_rank==PROC_SIPINIT && db_mode!=DB_ONLY) {
// if cache is used, populate domains from DB
for( ptr=root ; ptr ; ptr=ptr->next) {
LM_DBG("Preloading domain %.*s\n", ptr->name.len, ptr->name.s);
if (preload_udomain(ul_dbh, ptr->d) < 0) {
LM_ERR("child(%d): failed to preload domain '%.*s'\n",
_rank, ptr->name.len, ZSW(ptr->name.s));
return -1;
}
}
}
```
### Additional Information
* **Kamailio Version** - output of `kamailio -v`
```
it exists at latest version on master branch.
[here](https://github.com/kamailio/kamailio/blob/master/src/modules/ims_regi…
```
* **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 `uname -a`)
-->
```
CentOS 7.1
```
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/2809
<!--
Kamailio Project uses GitHub Issues only for bugs in the code or feature requests. Please use this template only for feature requests.
If you have questions about using Kamailio or related to its configuration file, ask on sr-users mailing list:
* http://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
If you have questions about developing extensions to Kamailio or its existing C code, ask on sr-dev mailing list:
* http://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev
Please try to fill this template as much as possible for any issue. It helps the developers to troubleshoot the issue.
If you submit a feature request (or enhancement) add the description of what you would like to be added.
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
It would be nice to have RCD (Rich Call Data) support in STIR/SHAKEN module.
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/2780
### Description
I am using Kamailio with Mariadb module
And i am get in Kamailio log some error messages:
```
"ERROR: db_mysql [km_dbase.c:122]: db_mysql_submit_query(): driver error on query: Table 'active_watchers' was not locked with LOCK TABLES (1100)"
"ERROR: db_mysql [km_dbase.c:122]: db_mysql_submit_query(): driver error on query: Table 'active_watchers' was not locked with LOCK TABLES (1100)"
"ERROR: db_mysql [km_dbase.c:122]: db_mysql_submit_query(): driver error on query: Table 'active_watchers' was not locked with LOCK TABLES (1100)"
```
After start debug log queries in Mariadb, i see queries in logfile like this:
```
1141 Query SET autocommit=0
1141 Query LOCK TABLES presentity WRITE
1141 Query update `presentity` set `etag`='a.1620236063.17716.2514.101',`expires`=1625215189,`received_time`=1625214589,`priority`=205144189,`body`='<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<presence xmlns:dm=\"urn:ietf:params:xml:ns:pidf:data-model\" xmlns:rpid=\"urn:ietf:params:xml:ns:pidf:rpid\" xmlns:pidfonline=\"http://www.linphone.org/xsds/pidfonline.xsd\" entity=\"sip:name_user@office-dev.com\" xmlns=\"urn:ietf:params:xml:ns:pidf\">\n <tuple id=\"bephbl\">\n <status>\n <basic>open</basic>\n <pidfonline:online/>\n </status>\n <contact priority=\"0.8\">sip:name_user@office-dev.com</contact>\n <timestamp>2021-07-01T17:20:41Z</timestamp>\n </tuple>\n</presence>\n' where `domain`='office-dev.com' AND `username`='name_user' AND `event`='presence' AND `etag`='a.1620236063.17716.2513.100'
1141 Query select `to_user`,`to_domain`,`from_user`,`from_domain`,`watcher_username`,`watcher_domain`,`event_id`,`from_tag`,`to_tag`,`callid`,`local_cseq`,`record_route`,`contact`,`expires`,`reason`,`socket_info`,`local_contact`,`version`,`flags`,`user_agent` from `active_watchers` where `presentity_uri`='sip:name_user@office-dev.com' AND `event`='presence' AND `status`=1 AND `contact`<>''
1141 Query COMMIT
1141 Query SET autocommit=1
1141 Query UNLOCK TABLES
```
or this one
```
1141 Query LOCK TABLES presentity WRITE
1141 Query insert into `presentity` (`domain`,`username`,`event`,`etag`,`sender`,`body`,`received_time`,`priority`,`expires` ) values ('dev.com','+121342','presence','a.1620236063.17716.2532.0','','<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<presence xmlns:dm=\"urn:ietf:params:xml:ns:pidf:data-model\" xmlns:rpid=\"urn:ietf:params:xml:ns:pidf:rpid\" xmlns:pidfonline=\"http://www.linphone.org/xsds/pidfonline.xsd\" entity=\"sip:+121342@dev.com\" xmlns=\"urn:ietf:params:xml:ns:pidf\">\n <tuple id=\"wumhh7\">\n <status>\n <basic>open</basic>\n <pidfonline:online/>\n </status>\n <contact priority=\"0.8\">sip:+121342@dev.com</contact>\n <timestamp>2021-07-02T10:55:26Z</timestamp>\n </tuple>\n</presence>\n',1625223329,205152929,1625226929)
1141 Query select `to_user`,`to_domain`,`from_user`,`from_domain`,`watcher_username`,`watcher_domain`,`event_id`,`from_tag`,`to_tag`,`callid`,`local_cseq`,`record_route`,`contact`,`expires`,`reason`,`socket_info`,`local_contact`,`version`,`flags`,`user_agent` from `active_watchers` where `presentity_uri`='sip:+121342@dev.com' AND `event`='presence' AND `status`=1 AND `contact`<>''
1141 Query COMMIT
1141 Query SET autocommit=1
1141 Query UNLOCK TABLES
```
This queries matches for time with reproduced errors in above kamailio log.
#### Reproduction
In test lab
```
MariaDB [kamailio]> LOCK TABLES presentity WRITE;
Query OK, 0 rows affected (0.00 sec)
MariaDB [kamailio]> select * from presentity;
Empty set (0.00 sec)
MariaDB [kamailio]> select * from active_watcher;
ERROR 1100 (HY000): Table 'active_watcher' was not locked with LOCK TABLES
MariaDB [kamailio]>
```
I get same error
Also i am found in additional documentation from Mysql next:
```
A session that requires locks must acquire all the locks that it needs in a single LOCK TABLES statement. While the locks thus obtained are held, the session can access only the locked tables.
```
or from Mariadb docs
```
While a connection holds an explicit lock on a table, it cannot access a non-locked table. If you try, the following error will be produced:
ERROR 1100 (HY000): Table 'tab_name' was not locked with LOCK TABLES
```
### Additional Information
* **Kamailio Version** *
```
Kamailio ver 5.4.5 or 5.6.0
```
So, maybe need add additional lock for table active_watchers or need take out query select from space LOCK - UNLOCK for resolve this issue?
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/2805