Description

Using kamailio 5.5.4 from the official Docker image (created like create_dockerfile.sh bullseye 5.5.4, but with no ENTRYPOINT).
Doing TLS listening like:

socket_workers=2
tls_max_connections=20000
listen=tls:192.168.0.11:5061
enable_tls=yes
dns_tls_pref=50
tls_port_no=5061
loadmodule "tls.so"

It is the second loaded module after tcpops.
Have to connect to the database through cnf files for the SSL support:
modparam("sqlops","sqlcon","euler=>mysql://[euler]/euclid")
Relevant section in the cnf file:

[euler]
port = 3306
host = 127.0.0.1
protocol = tcp
user = gauss
password = fermat
default-character-set = utf8
ssl-ca = /SSL/riemann/ca-cert.pem
ssl-cert = /SSL/riemann/client-cert.pem
ssl-key = /SSL/riemann/client-key.pem
#ssl-verify-server-cert

When starting kamailio:

 8(18) ERROR: db_mysql [km_my_con.c:163]: db_mysql_new_connection(): driver error: SSL connection error: PEM lib
 8(18) ERROR: <core> [db.c:319]: db_do_init2(): could not add connection to the pool
 8(18) ERROR: sqlops [sql_api.c:165]: sql_connect(): failed to connect to the database [euclid]
 8(18) ERROR: <core> [core/sr_module.c:874]: init_mod_child(): error while initializing module sqlops (/home/euler/lib64/euler/modules/sqlops.so) (idx: 8 rank: -2 desc: [Async Task Worker - default])
 8(18) ERROR: <core> [core/pt.c:338]: fork_process(): init_child failed for process 8, pid 18, "Async Task Worker - default"
 8(18) ERROR: <core> [main.c:1850]: main_loop(): error in init_child
12(22) CRITICAL: <core> [core/mem/q_malloc.c:501]: qm_free(): BUG: bad pointer 0x7fafa23e6270 (out of memory block!) called from tls: tls_init.c: ser_free(323) - ignoring

Then kamailio just hangs on in an incomplete state:

/ # ps auxww --forest
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root        29  0.6  0.0   4092  3244 pts/1    Ss   08:59   0:00 bash
root        36  0.0  0.0   6692  2964 pts/1    R+   08:59   0:00  \_ ps auxww --forest
root         1  0.0  0.0   4092  3252 pts/0    Ss   08:58   0:00 bash
root         8  0.4  0.0 110868 23764 pts/0    S+   08:58   0:00 kamailio -A NO_JSON_LOG -f /home/euler/etc/euler.cfg
root         9  0.0  0.0      0     0 ?        Zs   08:58   0:00  \_ [kamailio] <defunct>
root        10  0.5  0.0 111080 31148 ?        S    08:58   0:00 kamailio -A NO_JSON_LOG -f /home/euler/etc/euler.cfg
root        11  0.0  0.0 111080 13412 ?        S    08:58   0:00  \_ kamailio -A NO_JSON_LOG -f /home/euler/etc/euler.cfg
root        12 99.9  0.0 111080 13240 ?        R    08:58   0:43  \_ kamailio -A NO_JSON_LOG -f /home/euler/etc/euler.cfg
root        13  0.0  0.0 111080 14252 ?        S    08:58   0:00  \_ kamailio -A NO_JSON_LOG -f /home/euler/etc/euler.cfg
root        14  0.0  0.0 111080 13432 ?        S    08:58   0:00  \_ kamailio -A NO_JSON_LOG -f /home/euler/etc/euler.cfg
root        15  0.0  0.0 111080 13296 ?        S    08:58   0:00  \_ kamailio -A NO_JSON_LOG -f /home/euler/etc/euler.cfg
root        16  0.0  0.0 111080 13348 ?        S    08:58   0:00  \_ kamailio -A NO_JSON_LOG -f /home/euler/etc/euler.cfg
root        17  0.0  0.0 111080 13220 ?        S    08:58   0:00  \_ kamailio -A NO_JSON_LOG -f /home/euler/etc/euler.cfg
root        18  0.0  0.0 111072 14196 ?        S    08:58   0:00  \_ kamailio -A NO_JSON_LOG -f /home/euler/etc/euler.cfg
root        19 99.7  0.0 111080 10748 ?        R    08:58   0:43  \_ kamailio -A NO_JSON_LOG -f /home/euler/etc/euler.cfg
root        20  0.2  0.0      0     0 ?        Z    08:58   0:00  \_ [kamailio] <defunct>
root        21  0.0  0.0 111080 13068 ?        S    08:58   0:00  \_ kamailio -A NO_JSON_LOG -f /home/euler/etc/euler.cfg
root        22  0.0  0.0 111080 13156 ?        S    08:58   0:00  \_ kamailio -A NO_JSON_LOG -f /home/euler/etc/euler.cfg
root        23  0.0  0.0 111080 10684 ?        S    08:58   0:00  \_ kamailio -A NO_JSON_LOG -f /home/euler/etc/euler.cfg
root        24  0.0  0.0 111080 10684 ?        S    08:58   0:00  \_ kamailio -A NO_JSON_LOG -f /home/euler/etc/euler.cfg
root        25  0.0  0.0 111080 10748 ?        S    08:58   0:00  \_ kamailio -A NO_JSON_LOG -f /home/euler/etc/euler.cfg
root        26  0.0  0.0 111080 10748 ?        S    08:58   0:00  \_ kamailio -A NO_JSON_LOG -f /home/euler/etc/euler.cfg
root        27  0.0  0.0 111080 13344 ?        S    08:58   0:00  \_ kamailio -A NO_JSON_LOG -f /home/euler/etc/euler.cfg
root        28  0.0  0.0 111080 10748 ?        S    08:58   0:00  \_ kamailio -A NO_JSON_LOG -f /home/euler/etc/euler.cfg

Troubleshooting

Reproduction

It is always happening, but not when either listen=tls or the SSL options in the cnf file are dropped.

Debugging Data

/ # ps auxww --forest
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root        29  0.6  0.0   4092  3244 pts/1    Ss   08:59   0:00 bash
root        36  0.0  0.0   6692  2964 pts/1    R+   08:59   0:00  \_ ps auxww --forest
root         1  0.0  0.0   4092  3252 pts/0    Ss   08:58   0:00 bash
root         8  0.4  0.0 110868 23764 pts/0    S+   08:58   0:00 kamailio -A NO_JSON_LOG -f /home/euler/etc/euler.cfg
root         9  0.0  0.0      0     0 ?        Zs   08:58   0:00  \_ [kamailio] <defunct>
root        10  0.5  0.0 111080 31148 ?        S    08:58   0:00 kamailio -A NO_JSON_LOG -f /home/euler/etc/euler.cfg
root        11  0.0  0.0 111080 13412 ?        S    08:58   0:00  \_ kamailio -A NO_JSON_LOG -f /home/euler/etc/euler.cfg
root        12 99.9  0.0 111080 13240 ?        R    08:58   0:43  \_ kamailio -A NO_JSON_LOG -f /home/euler/etc/euler.cfg
root        13  0.0  0.0 111080 14252 ?        S    08:58   0:00  \_ kamailio -A NO_JSON_LOG -f /home/euler/etc/euler.cfg
root        14  0.0  0.0 111080 13432 ?        S    08:58   0:00  \_ kamailio -A NO_JSON_LOG -f /home/euler/etc/euler.cfg
root        15  0.0  0.0 111080 13296 ?        S    08:58   0:00  \_ kamailio -A NO_JSON_LOG -f /home/euler/etc/euler.cfg
root        16  0.0  0.0 111080 13348 ?        S    08:58   0:00  \_ kamailio -A NO_JSON_LOG -f /home/euler/etc/euler.cfg
root        17  0.0  0.0 111080 13220 ?        S    08:58   0:00  \_ kamailio -A NO_JSON_LOG -f /home/euler/etc/euler.cfg
root        18  0.0  0.0 111072 14196 ?        S    08:58   0:00  \_ kamailio -A NO_JSON_LOG -f /home/euler/etc/euler.cfg
root        19 99.7  0.0 111080 10748 ?        R    08:58   0:43  \_ kamailio -A NO_JSON_LOG -f /home/euler/etc/euler.cfg
root        20  0.2  0.0      0     0 ?        Z    08:58   0:00  \_ [kamailio] <defunct>
root        21  0.0  0.0 111080 13068 ?        S    08:58   0:00  \_ kamailio -A NO_JSON_LOG -f /home/euler/etc/euler.cfg
root        22  0.0  0.0 111080 13156 ?        S    08:58   0:00  \_ kamailio -A NO_JSON_LOG -f /home/euler/etc/euler.cfg
root        23  0.0  0.0 111080 10684 ?        S    08:58   0:00  \_ kamailio -A NO_JSON_LOG -f /home/euler/etc/euler.cfg
root        24  0.0  0.0 111080 10684 ?        S    08:58   0:00  \_ kamailio -A NO_JSON_LOG -f /home/euler/etc/euler.cfg
root        25  0.0  0.0 111080 10748 ?        S    08:58   0:00  \_ kamailio -A NO_JSON_LOG -f /home/euler/etc/euler.cfg
root        26  0.0  0.0 111080 10748 ?        S    08:58   0:00  \_ kamailio -A NO_JSON_LOG -f /home/euler/etc/euler.cfg
root        27  0.0  0.0 111080 13344 ?        S    08:58   0:00  \_ kamailio -A NO_JSON_LOG -f /home/euler/etc/euler.cfg
root        28  0.0  0.0 111080 10748 ?        S    08:58   0:00  \_ kamailio -A NO_JSON_LOG -f /home/euler/etc/euler.cfg

Log Messages

 8(18) ERROR: db_mysql [km_my_con.c:163]: db_mysql_new_connection(): driver error: SSL connection error: PEM lib
 8(18) ERROR: <core> [db.c:319]: db_do_init2(): could not add connection to the pool
 8(18) ERROR: sqlops [sql_api.c:165]: sql_connect(): failed to connect to the database [euclid]
 8(18) ERROR: <core> [core/sr_module.c:874]: init_mod_child(): error while initializing module sqlops (/home/euler/lib64/euler/modules/sqlops.so) (idx: 8 rank: -2 desc: [Async Task Worker - default])
 8(18) ERROR: <core> [core/pt.c:338]: fork_process(): init_child failed for process 8, pid 18, "Async Task Worker - default"
 8(18) ERROR: <core> [main.c:1850]: main_loop(): error in init_child
12(22) CRITICAL: <core> [core/mem/q_malloc.c:501]: qm_free(): BUG: bad pointer 0x7fafa23e6270 (out of memory block!) called from tls: tls_init.c: ser_free(323) - ignoring

SIP Traffic

(paste your sip traffic here)

Possible Solutions

Additional Information

version: kamailio 5.5.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, 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 10.2.1
Linux euler01 5.4.44-2-pve #1 SMP PVE 5.4.44-2 (Wed, 01 Jul 2020 16:37:57 +0200) x86_64 GNU/Linux


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <kamailio/kamailio/issues/3115@github.com>