<p></p>

<h3 dir="auto">Description</h3>
<p dir="auto">Using kamailio 5.5.4 from the official Docker image (created like <code class="notranslate">create_dockerfile.sh bullseye 5.5.4</code>, but with no ENTRYPOINT).<br>
Doing TLS listening like:</p>
<pre class="notranslate"><code class="notranslate">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"
</code></pre>
<p dir="auto">It is the second loaded module after tcpops.<br>
Have to connect to the database through cnf files for the SSL support:<br>
<code class="notranslate">modparam("sqlops","sqlcon","euler=>mysql://[euler]/euclid")</code><br>
Relevant section in the cnf file:</p>
<pre class="notranslate"><code class="notranslate">[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
</code></pre>
<p dir="auto">When starting kamailio:</p>
<pre class="notranslate"><code class="notranslate"> 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
</code></pre>
<p dir="auto">Then kamailio just hangs on in an incomplete state:</p>
<pre class="notranslate"><code class="notranslate">/ # 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
</code></pre>

<h3 dir="auto">Troubleshooting</h3>
<h4 dir="auto">Reproduction</h4>

<p dir="auto">It is always happening, but not when either <code class="notranslate">listen=tls</code> or the SSL options in the cnf file are dropped.</p>
<h4 dir="auto">Debugging Data</h4>

<pre class="notranslate"><code class="notranslate">/ # 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
</code></pre>
<h4 dir="auto">Log Messages</h4>

<pre class="notranslate"><code class="notranslate"> 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
</code></pre>
<h4 dir="auto">SIP Traffic</h4>

<pre class="notranslate"><code class="notranslate">(paste your sip traffic here)
</code></pre>
<h3 dir="auto">Possible Solutions</h3>

<h3 dir="auto">Additional Information</h3>
<ul dir="auto">
<li><strong>Kamailio Version</strong> - output of <code class="notranslate">kamailio -v</code></li>
</ul>
<pre class="notranslate"><code class="notranslate">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
</code></pre>
<ul dir="auto">
<li><strong>Operating System</strong>:</li>
</ul>

<pre class="notranslate"><code class="notranslate">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
</code></pre>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />Reply to this email directly, <a href="https://github.com/kamailio/kamailio/issues/3115">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/ABO7UZNJDVJNLDY5ZFZPXITVKS4SBANCNFSM5WH3XHJQ">unsubscribe</a>.<br />You are receiving this because you are subscribed to this thread.<img src="https://github.com/notifications/beacon/ABO7UZIJAX7D44TISPAY7TDVKS4SBA5CNFSM5WH3XHJ2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4SPEOQNA.gif" height="1" width="1" alt="" /><span style="color: transparent; font-size: 0; display: none; visibility: hidden; overflow: hidden; opacity: 0; width: 0; height: 0; max-width: 0; max-height: 0; mso-hide: all">Message ID: <span><kamailio/kamailio/issues/3115</span><span>@</span><span>github</span><span>.</span><span>com></span></span></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/kamailio/kamailio/issues/3115",
"url": "https://github.com/kamailio/kamailio/issues/3115",
"name": "View Issue"
},
"description": "View this Issue on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>