sergey-safarov created an issue (kamailio/kamailio#4356)
### Description
Kamailio core generated when `siptrace` module tries to relay a message
generated by `uac` module.
### Troubleshooting
#### Reproduction
To reproduce the issue need to start Kamailio with the config file.
```
#!KAMAILIO
#!define L_INFO 2
#!trydef TROUBLESHOOT_NET ""
local.trace_troubleshooting_net = TROUBLESHOOT_NET descr "trace all SIP
messages from given network"
# IPv4 listeners
listen=udp:lan
debug=L_INFO
log_stderror=yes
loadmodule "pv.so"
loadmodule "tm.so"
####### DATABASE module ##########
#!substdef
"!KAMAILIO_DB_URL!mysql://kamailio:change_me@127.0.0.1:3306/kamailio!g"
loadmodule "db_mysql.so"
loadmodule "uac.so"
modparam("uac", "reg_db_url", "KAMAILIO_DB_URL")
modparam("uac", "reg_contact_addr", "192.168.1.2:5080")
modparam("uac","restore_mode","none")
####### siptrace module ##########
loadmodule "siptrace.so"
modparam("siptrace", "duplicate_uri", "sip:127.0.0.1:9060")
modparam("siptrace", "trace_to_database", 0)
modparam("siptrace", "trace_on", 1)
modparam("siptrace", "trace_mode", 1)
####### Routing Logic ########
request_route {
drop;
}
event_route[siptrace:msg]
{
if ($sel(cfg_get.local.trace_troubleshooting_net) != "") {
return;
}
}
```
In the database, need to inserta record
```sql
INSERT INTO `uacreg` VALUES
(1,'120','120','example.com','120','10.191.1.21','','120','','8e789f9318c98b9ffd4f0fd9e0b8a747','sip:10.191.1.21;transport=udp',120,0,0,'','');
```
#### Debugging Data
Backtrace for the generated core in the attached file
[kamailio-bt-full.txt](https://github.com/user-attachments/files/21671121/kamailio-bt-full.txt)
#### Log Messages
```
/ # kamailio -DD --atexit=no -m 64 -M 8 -E
0(43) INFO: <core> [core/sctp_core.c:74]: sctp_core_check_support(): SCTP API
not enabled - if you want to use it, load sctp module
Listening on
udp: 10.191.1.20:5060
Aliases:
udp: ip-10-191-1-20.ec2.internal:5060
0(43) INFO: <core> [core/tcp_main.c:5232]: init_tcp(): using epoll_lt as the
io watch method (auto detected)
0(43) INFO: siptrace [siptrace.c:438]: mod_init(): can't load dlg api. Will
not install dialog callbacks.
0(43) ERROR: siptrace [../../modules/sl/sl.h:107]: sl_load_api(): cannot find
bind_sl
0(43) WARNING: siptrace [siptrace.c:450]: mod_init(): cannot bind to SL API.
Will not install sl callbacks.
0(43) INFO: <core> [main.c:3233]: main(): processes (at least): 14 - shm size:
67108864 - pkg size: 8388608
0(43) INFO: <core> [core/udp_server.c:163]: probe_max_receive_buffer():
SO_RCVBUF is initially 212992 for fd 4
0(43) INFO: <core> [core/udp_server.c:233]: probe_max_receive_buffer():
SO_RCVBUF is finally 425984 on fd 4
0(43) INFO: <core> [core/udp_server.c:264]: probe_max_send_buffer(): SO_SNDBUF
is initially 212992 for fd 4
0(43) INFO: <core> [core/udp_server.c:334]: probe_max_send_buffer(): SO_SNDBUF
is finally 425984 on fd 4
0(43) ALERT: <core> [main.c:805]: handle_sigs(): child process 55 exited by a
signal 11
0(43) ALERT: <core> [main.c:809]: handle_sigs(): core was generated
0(43) INFO: <core> [main.c:832]: handle_sigs(): terminating due to SIGCHLD
1(44) INFO: <core> [main.c:888]: sig_usr(): signal 15 received
2(45) INFO: <core> [main.c:888]: sig_usr(): signal 15 received
3(46) INFO: <core> [main.c:888]: sig_usr(): signal 15 received
4(47) INFO: <core> [main.c:888]: sig_usr(): signal 15 received
5(48) INFO: <core> [main.c:888]: sig_usr(): signal 15 received
6(49) INFO: <core> [main.c:888]: sig_usr(): signal 15 received
7(50) INFO: <core> [main.c:888]: sig_usr(): signal 15 received
8(51) INFO: <core> [main.c:888]: sig_usr(): signal 15 received
9(52) INFO: <core> [main.c:888]: sig_usr(): signal 15 received
13(56) INFO: <core> [main.c:888]: sig_usr(): signal 15 received
10(53) INFO: <core> [main.c:888]: sig_usr(): signal 15 received
11(54) INFO: <core> [main.c:888]: sig_usr(): signal 15 received
0(43) INFO: <core> [core/sctp_core.c:53]: sctp_core_destroy(): SCTP API not
initialized
```
### Possible Solutions
As temporary workaround we use
```diff
diff --git a/src/core/cfg/cfg_select.c b/src/core/cfg/cfg_select.c
index f948dd4ab4..1a36ef378a 100644
--- a/src/core/cfg/cfg_select.c
+++ b/src/core/cfg/cfg_select.c
@@ -207,8 +207,10 @@ int select_cfg_var(str *res, select_t *s, struct sip_msg
*msg)
group = (cfg_group_t *)s->params[1].v.p;
var = (cfg_mapping_t *)s->params[2].v.p;
- if(!group || !var)
+ if(!group || !var || NULL == *(group->handle)) {
+ LM_ERR("incorrect input args\n");
return -1;
+ }
/* use the module's handle to access the variable, so the variables
* are read from the local config */
```
### Additional Information
* **Kamailio Version** - output of `kamailio -v`
```
/ # kamailio -v
version: kamailio 5.8.4 (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, MEM_JOIN_FREE, 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_SEND_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 on 14:31:12 Nov 18 2024 with gcc 14.2.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`)
-->
```
NAME="Alpine Linux"
ID=alpine
VERSION_ID=3.21.4
PRETTY_NAME="Alpine Linux v3.21"
HOME_URL="https://alpinelinux.org/"
BUG_REPORT_URL="https://gitlab.alpinelinux.org/alpine/aports/-/issues"
```
uname
```
Linux sbc0-site0-stage.ph.nga911.com 6.15.5-200.fc42.x86_64 #1 SMP
PREEMPT_DYNAMIC Sun Jul 6 09:16:17 UTC 2025 x86_64 Linux
```
--
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/4356
You are receiving this because you are subscribed to this thread.
Message ID: <kamailio/kamailio/issues/4...@github.com>
_______________________________________________
Kamailio - Development Mailing List -- sr-dev@lists.kamailio.org
To unsubscribe send an email to sr-dev-le...@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the
sender!