### Description
Ubuntu 18.04 offers both libssl 1.0 and 1.1, however the -dev packages conflict between them and only one can be installed at a given time. The libmysqlclient-dev (the MySQL project, not MariaDB) requires the libssl1.1-dev, so only this one can be used to compile at the same time db_mysql and tls.
During start up, a few kamailio processes die due to a crash in libmysqlclient, referencing the use of libssl and libcrypto. This happens when connecting over IP sockets to MySQL server, not over local unix file socket (which is done when using `localhost` for db server host).
The solution so far was to add a new modparam opt_ssl_mode to db_mysql to set the SSL mode for the connection, allowing to disable it. Without, the client library attempts always to use SSL/TLS.
A set of commits were pushed recently to db_mysql modules:
* https://github.com/kamailio/kamailio/commits/master/src/modules/db_mysql
I plan to backport them 5.3 and 5.2 branches, in order to fix the crash and be able to connect to MySQL servers in private network. It proved that the SSL mode options can be set only when MySQL Project libmysqlclient library is used (and maybe only when using the MySQL server, in my case it was MySQL server 5.7.30), the MariaDB client library does not offer these options.
Wondering if anyone else experienced something similar?
### Troubleshooting
#### Reproduction
Kamailio v5.2.7 compiled from sources on Ubuntu 18.04 with db_mysql and tls loaded.
#### Debugging Data
A backtrace looks like:
```
(paste your debugging data here)#0 X509_LOOKUP_ctrl (ctx=0x15328f0b9ac0, cmd=2, argc=0x0, argl=3, ret=0x0) at ../crypto/x509/x509_lu.c:79
#1 0x00001532b24dcc7c in X509_STORE_set_default_paths (ctx=0x15328fed9f18) at ../crypto/x509/x509_d2.c:27
#2 0x00001532b27f2d79 in SSL_CTX_set_default_verify_paths (ctx=<optimized out>) at ../ssl/ssl_lib.c:3991
#3 0x00001532b2ecc364 in new_VioSSLFd (key_file=0x0, cert_file=0x0, ca_file=0x0, ca_path=0x0, cipher=0x0, is_client=is_client@entry=1 '\001', error=0x7ffd8c3a8090,
crl_file=0x0, crl_path=0x0, ssl_ctx_flags=0) at ./vio/viosslfactories.c:623
#4 0x00001532b2ecc9e3 in new_VioSSLConnectorFd (key_file=<optimized out>, cert_file=<optimized out>, ca_file=<optimized out>, ca_path=<optimized out>, cipher=<optimized out>,
error=error@entry=0x7ffd8c3a8090, crl_file=0x0, crl_path=0x0, ssl_ctx_flags=0) at ./vio/viosslfactories.c:710
#5 0x00001532b2e9f3f7 in cli_establish_ssl (mysql=0x1532b5abb698) at ./sql-common/client.c:3492
#6 mysql_real_connect (mysql=0x1532b5abb698, host=<optimized out>, user=<optimized out>, passwd=<optimized out>, db=0x1532b5a2e4b0 "enswitch", port=<optimized out>,
unix_socket=<optimized out>, client_flag=65536) at ./sql-common/client.c:4609
#7 0x00001532b343a0fc in db_mysql_new_connection (id=0x1532b5a2e268) at km_my_con.c:137
#8 0x00001532b4f4dbdf in db_do_init2 (url=0x1532b53bc420 <db_url>, new_connection=0x1532b3438c9b <db_mysql_new_connection>, pooling=DB_POOLING_PERMITTED) at db.c:317
#9 0x00001532b4f4cb65 in db_do_init (url=0x1532b53bc420 <db_url>, new_connection=0x1532b3438c9b <db_mysql_new_connection>) at db.c:270
#10 0x00001532b34301e6 in db_mysql_init (_url=0x1532b53bc420 <db_url>) at km_dbase.c:206
#11 0x00001532b518dedd in child_init (_rank=37) at usrloc_mod.c:435
#12 0x0000559b145fcec0 in init_mod_child (m=0x1532b59cdb08, rank=37) at core/sr_module.c:846
#13 0x0000559b145fcb43 in init_mod_child (m=0x1532b59cdfa8, rank=37) at core/sr_module.c:842```
### Possible Solutions
Patches in master branch for db_mysql module
### Additional Information
* **Kamailio Version** - output of `kamailio -v`
```
5.2.7
```
* **Operating System**:
```
Ubuntu 18.04 - Linux4.15.0-101-generic #102-Ubuntu SMP Mon May 11 10:07:26 UTC 2020 x86_64 x86_64 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/2360
<!--
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 ran into an issue where the Kamailio service seemingly froze (didn't crash, but failed to receive and deliver calls) while running, I went through the logs a little bit, and saw the same log pattern (pasted below) recouring every few months or so, on an older installation (5.2.0). Usually, it ended up automatically restarting the service. But not this time, I had to reload it manually to make the service work again.
Is this a known issue?
How can I make sure that the service will be able to restart the next time it happens?
Edward
### Troubleshooting
#### 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/
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 (Ubuntu 7.11.1-0ubuntu1~16.5) 7.11.1
Copyright (C) 2016 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 "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://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/local/sbin/kamailio...done.
warning: exec file is newer than core file.
[New LWP 11413]
Core was generated by `kamailio'.
Program terminated with signal SIGABRT, Aborted.
#0 0x00007f4e4a52e428 in ?? ()
(gdb) Quit
(gdb) bt full
#0 0x00007f4e4a52e428 in ?? ()
No symbol table info available.
#1 0x00007f4e4a53002a in ?? ()
No symbol table info available.
#2 0x0000000000000020 in ?? ()
No symbol table info available.
#3 0x0000000000000000 in ?? ()
No symbol table info available.
(gdb) info locals
No symbol table info available.
(gdb) list
1871 & now if we don't need it */
1872 #ifdef USE_SLOW_TIMER
1873 + 1 /* slow timer process */
1874 #endif
1875 #ifdef USE_TCP
1876 +((!tcp_disable)?( 1/* tcp main */ + tcp_listeners ):0)
1877 #endif
1878 #ifdef USE_SCTP
1879 +((!sctp_disable)?sctp_listeners:0)
1880 #endif
(gdb)
```
#### 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).
-->
```
Jun 28 16:35:22 kamprodegres kamailio: INFO: <core> [core/sctp_core.c:74]: sctp_core_check_support(): SCTP API not enabled - if you want to use it, load sctp module
Jun 28 16:35:22 kamprodegres kamailio: WARNING: <core> [core/socket_info.c:1394]: fix_hostname(): could not rev. resolve 70.36.25.87
Jun 28 16:35:22 kamprodegres kamailio: WARNING: <core> [core/socket_info.c:1394]: fix_hostname(): could not rev. resolve 70.36.25.87
Jun 28 16:35:22 kamprodegres kamailio: INFO: <core> [core/tcp_main.c:5042]: init_tcp(): using epoll_lt as the io watch method (auto detected)
Jun 28 16:35:22 kamprodegres kamailio[8489]: INFO: jsonrpcs [jsonrpcs_sock.c:197]: jsonrpc_dgram_mod_init(): the socket /var/run/kamailio/kamailio_rpc.sock already exists, trying to delete it...
Jun 28 16:35:22 kamprodegres kamailio[8489]: INFO: rr [../outbound/api.h:52]: ob_load_api(): unable to import bind_ob - maybe module is not loaded
Jun 28 16:35:22 kamprodegres kamailio[8489]: INFO: rr [rr_mod.c:177]: mod_init(): outbound module not available
Jun 28 16:35:22 kamprodegres kamailio[8489]: INFO: <core> [main.c:2779]: main(): processes (at least): 40 - shm size: 67108864 - pkg size: 8388608
Jun 28 16:35:22 kamprodegres kamailio[8489]: INFO: <core> [core/udp_server.c:154]: probe_max_receive_buffer(): SO_RCVBUF is initially 212992
Jun 28 16:35:22 kamprodegres kamailio[8489]: INFO: <core> [core/udp_server.c:206]: probe_max_receive_buffer(): SO_RCVBUF is finally 425984
Jun 28 16:35:22 kamprodegres kamailio[8489]: INFO: <core> [core/udp_server.c:154]: probe_max_receive_buffer(): SO_RCVBUF is initially 212992
Jun 28 16:35:22 kamprodegres kamailio[8489]: INFO: <core> [core/udp_server.c:206]: probe_max_receive_buffer(): SO_RCVBUF is finally 425984
Jun 28 16:35:22 kamprodegres kamailio[8489]: INFO: <core> [core/udp_server.c:154]: probe_max_receive_buffer(): SO_RCVBUF is initially 212992
Jun 28 16:35:22 kamprodegres kamailio[8489]: INFO: <core> [core/udp_server.c:206]: probe_max_receive_buffer(): SO_RCVBUF is finally 425984
Jun 28 16:35:22 kamprodegres kamailio[8518]: INFO: jsonrpcs [jsonrpcs_sock.c:443]: jsonrpc_dgram_process(): a new child 0/8518
Jun 28 16:35:22 kamprodegres kamailio[8519]: INFO: ctl [io_listener.c:214]: io_listen_loop(): io_listen_loop: using epoll_lt io watch method (config)
Jun 29 18:13:37 kamprodegres kamailio[8513]: INFO: {1 581461 CANCEL 402954192_49936786(a)67.231.13.146} tm [t_reply.c:478]: _reply_light(): can't generate 487 reply when a final 404 was sent out
Jun 29 18:27:00 kamprodegres kamailio[8508]: INFO: {1 211236 CANCEL 405019408_127896329(a)67.231.13.146} tm [t_reply.c:478]: _reply_light(): can't generate 487 reply when a final 404 was sent out
Jun 29 18:51:10 kamprodegres /usr/local/sbin/kamailio[2269]: NOTICE: <core> [main.c:725]: handle_sigs(): Thank you for flying kamailio!!!
Jun 29 18:51:10 kamprodegres /usr/local/sbin/kamailio[2326]: INFO: <core> [main.c:847]: sig_usr(): signal 15 received
```
### Additional Information
* **Kamailio Version** - output of `kamailio -v`
```
version: kamailio 5.3.2 (x86_64/linux) 7ba545
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
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: 7ba545
compiled on 16:37:32 Jun 14 2020 with gcc 5.4.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 `uname -a`)
-->
```
Ubuntu 16.04
```
--
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/2380
### Description
Introduce a permanent usrloc entry with kamctl not working, but introduce a temporary usrloc entry with expires date is ok for me.
### Troubleshooting
#### Debugging Data
`kamctl ul add +982191079726 sip:+982191079726@172.22.132.230:5060`
#### Log Messages
{
"jsonrpc": "2.0",
"error": {
"code": 500,
"message": "Not enough parameters or wrong format"
},
"id": 107809
}
When I try with introduce a temporary usrloc entry every thing is ok.
`kamctl ul add +982191079723 sip:+982191079723@172.22.132.235 2020-07-30 08:51:40`
```
{
"jsonrpc": "2.0",
"result": {
},
"id": 107852
}
```
### Additional Information
```
version: kamailio 5.0.8 (x86_64/linux)
flags: STATS: Off, USE_TCP, USE_TLS, USE_SCTP, TLS_HOOKS, USE_RAW_SOCKS, DISABLE_NAGLE, USE_MCAST, DNS_IP_HACK, SHM_MEM, 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
ADAPTIVE_WAIT_LOOPS=1024, MAX_RECV_BUFFER_SIZE 262144, MAX_LISTEN 16, 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 6.3.0
```
* **Operating System**:
```
Linux trunk2-sbc 4.9.0-6-amd64 #1 SMP Debian 4.9.88-1+deb9u1 (2018-05-07) 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/2379
Yes, $xavp(s) are bound to the transaction, like the $avp.
About the memory fragmentation - the memory manager should re-use fitting memory blocks, but this depends on the overall traffic to the server. In general, if you use a recent kamailio version, we activated the memory defragmentation some time ago. This should reduce the number of fragements. You can check with the shm stats. On old servers you can activate with a core parameter.
Cheers,
Henning
--
Henning Westerholt – https://skalatan.de/blog/
Kamailio services – https://gilawa.com
-----Original Message-----
From: sr-users <sr-users-bounces(a)lists.kamailio.org> On Behalf Of Alex Balashov
Sent: Monday, June 29, 2020 10:31 PM
To: sr-users(a)lists.kamailio.org
Subject: Re: [SR-Users] Sql_result_free() not cleaning properly
On 6/29/20 4:27 PM, Henning Westerholt wrote:
> I guess you are using sql_xquery? The sql_free_result will only free a
> native sql result in script, not the xavp.
But the XAVP goes out of scope once the transaction to which it pertains expires, right? And accordingly should be freed?
(This also leads one to wonder: if the same XAVP name is referenced in a subsequent sql_xquery() call in the course of processing the same message, will it free and re-allocate memory for a new PV, perhaps contributing to unnecessary fragmentation? Or will it simply reuse the SHM block for the previously allocated PV?)
-- Alex
--
Alex Balashov | Principal | Evariste Systems LLC
Tel: +1-706-510-6800 / +1-800-250-5920 (toll-free)
Web: http://www.evaristesys.com/, http://www.csrpswitch.com/
_______________________________________________
Kamailio (SER) - Users Mailing List
sr-users(a)lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
### Description
I want start kamailio as `root` user with carrierroute module.
and get this error message
```
[root@ip-172-22-6-233 config]# kamailio -DD -E
0(13687) 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: 172.22.6.233:5060
tcp: 172.22.6.233:5060
Aliases:
tcp: ip-172-22-6-233.us-west-1.compute.internal:5060
udp: ip-172-22-6-233.us-west-1.compute.internal:5060
0(13687) INFO: <core> [core/tcp_main.c:5042]: init_tcp(): using epoll_lt as the io watch method (auto detected)
0(13687) INFO: carrierroute [carrierroute.c:197]: mod_init(): use file as configuration source
0(13687) ERROR: carrierroute [carrierroute.c:219]: mod_init(): config file /etc/kamailio/carrierroute.conf not writable
0(13687) ERROR: <core> [core/sr_module.c:849]: init_mod(): Error while initializing module carrierroute (/usr/lib64/kamailio/modules/carrierroute.so)
ERROR: error while initializing modules
0(13687) INFO: <core> [core/sctp_core.c:53]: sctp_core_destroy(): SCTP API not initialized
```
I checked file permissions
```sh
[root@ip-172-22-6-233 config]# ls -l /etc/kamailio/carrierroute.conf
-rw-rw----. 1 kamailio kamailio 403 Jun 23 18:07 /etc/kamailio/carrierroute.conf
```
Looks as file permissions as expected.
### Troubleshooting
Issue related to a difference of process user/group and file user/group.
#### Reproduction
1) create `/etc/kamailio/carrierroute.conf` with kamailio user/group;
2) change file permissions to 660;
3) start kamailio as root user
#### Debugging Data
none
#### Log Messages
none
#### SIP Traffic
none
### Possible Solutions
Add information about the expected user group permissions, like
```
config file /etc/kamailio/carrierroute.conf not writable or not owned by "root" user and "root" group
```
### Additional Information
* **Kamailio Version** - output of `kamailio -v`
```
[root@ip-172-22-6-233 config]# kamailio -v
version: kamailio 5.3.4 (x86_64/linux) 117ff9
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: 117ff9
compiled on 15:31:51 May 6 2020 with gcc 8.3.1
```
* **Operating System**:
```
[root@ip-172-22-6-233 config]# cat /etc/os-release
NAME="CentOS Linux"
VERSION="8 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="8"
PLATFORM_ID="platform:el8"
PRETTY_NAME="CentOS Linux 8 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:8"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"
CENTOS_MANTISBT_PROJECT="CentOS-8"
CENTOS_MANTISBT_PROJECT_VERSION="8"
REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="8"
```
--
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/2369
Module: kamailio
Branch: master
Commit: 7ac314353f206924234ee416829fc9d75f52a737
URL: https://github.com/kamailio/kamailio/commit/7ac314353f206924234ee416829fc9d…
Author: Kamailio Dev <kamailio.dev(a)kamailio.org>
Committer: Kamailio Dev <kamailio.dev(a)kamailio.org>
Date: 2020-06-29T08:31:12+02:00
modules: readme files regenerated - carrierroute ... [skip ci]
---
Modified: src/modules/carrierroute/README
---
Diff: https://github.com/kamailio/kamailio/commit/7ac314353f206924234ee416829fc9d…
Patch: https://github.com/kamailio/kamailio/commit/7ac314353f206924234ee416829fc9d…
---
diff --git a/src/modules/carrierroute/README b/src/modules/carrierroute/README
index cb659bdf75..8f1b4a0532 100644
--- a/src/modules/carrierroute/README
+++ b/src/modules/carrierroute/README
@@ -365,7 +365,8 @@ modparam("carrierroute", "config_source", "file")
3.6. config_file (string)
- Specifies the path to the config file.
+ Specifies the path to the config file. The file has to be owned by the
+ user and group used to run Kamailio.
Default value is “/etc/kamailio/carrierroute.conf”.