### Description
Kamailio fails to start after recent changes were made to improve support for OpenSSL 3.X. The failure occurs for both OpenSSL 3.X and OpenSSL 1.1.X, and are the same as failures I had been seeing on previous Kamailio versions when using OpenSSL 3.X. These errors were not occurring for OpenSSL 1.1.X prior to commits on Jan 4, 2024.
My configuration is using the unixodbc module to communicate with a Microsoft SQL Server database. Furthermore, the dispatcher module is configured to use the database.
With this configuration, Kamailio always fails at startup. It may log a "freeing already free pointer bug" or sometimes indicates pointer corruption. In either case, it fails to connect to the database.
#### Reproduction
Start Kamailio with configuration files similar to the following. For the log file shown below, Kamailio was started with "kamailio -dd -E --atexit=no"
[kamailio.txt](https://github.com/kamailio/kamailio/files/14068346/kamailio.txt)
[tls.txt](https://github.com/kamailio/kamailio/files/14068347/tls.txt)
#### Log Messages
[kamailio.log](https://github.com/kamailio/kamailio/files/14068278/kamailio.log)
#### SIP Traffic
None. Problem occurs during initialization.
### Additional Information
* **Kamailio Version** - output of `kamailio -v`
version: kamailio 5.8.0-dev2 (x86_64/linux) 4db5d7-dirty 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: 4db5d7 -dirty compiled on 17:44:29 Jan 26 2024 with gcc 9.4.0
* **Operating System**:
Distributor ID: Ubuntu Description: Ubuntu 20.04.6 LTS Release: 20.04 Codename: focal
Kernel: 5.4.0-170-generic
(Similar behavior is seen on Ubuntu 22.04 using OpenSSL 3.X.)
@kdanderso -
I. can you replace tls with tls_wolfssl ; does that stop the qm_free errors?
II. In your config - remove the tls configuration completetly - run the main process under control of gdb (no need to follow the child processes) and submit the log ( it will be very long) ``` # gdb --args kamailio xxxx xxxx xxxxx#put all your arguments here
break CRYPTO_THREAD_set_local commands bt cont end run
```
Since tls has been removed: you should be able to have your config start up (i.e. until all the child processes are successfully forked and initialised).
Should be fixed with https://github.com/kamailio/kamailio/pull/3728. Please test.
Verified with the MariaDB ODBC connector that links to the system libssl.so.3.
This seems to take care of the problem. I am now able to load and run my configuration successfully. Thank you.
Closed #3727 as completed.
Commited fixes for unixodbc, mysql, postgresql to master. Closing.