[kamailio/kamailio] http_client/http_async_client crash at startup if used with tls and openssl 1.1 (Issue #2912)
### Description When attempting to use either http_client or http_async_client with tls support enabled and openssl version 1.1.x, Kamailio crashes at startup. If openssl is reverted to version 1.0.2r as described in #1860, the issue does not occur. #### Reproduction On a system using openssl version 1.1.x (e.g. 1.1.1l) start Kamailio 5.5.2 with this config file for http_client failure: [kamailio.cfg.txt](https://github.com/kamailio/kamailio/files/7442436/kamailio.cfg.txt) To test http_async_client, load pv.so and http_async_client.so instead of http_client.so. #### Debugging Data [bt.txt](https://github.com/kamailio/kamailio/files/7442493/bt.txt) #### Log Messages [kam.log.txt](https://github.com/kamailio/kamailio/files/7442496/kam.log.txt) ### Additional Information * **Kamailio Version**: [kamversion.txt](https://github.com/kamailio/kamailio/files/7442506/kamversion.txt) * **Operating System**: Linux 5.4.0-89-generic #100-Ubuntu SMP Fri Sep 24 14:50:10 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux [os.txt](https://github.com/kamailio/kamailio/files/7442509/os.txt) -- 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/2912
confirmed, reproduced with docker focal image -- 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/2912#issuecomment-975550251
output of ```kamailio -ddd``` [k.log](https://github.com/kamailio/kamailio/files/7581879/k.log) -- 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/2912#issuecomment-975583661
``` libcurl4: 7.68.0-1ubuntu2.7 libssl1.1: 1.1.1f-1ubuntu2.9 ``` -- 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/2912#issuecomment-983669978
@grumvalski do you have any clues why this is happening? -- 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/2912#issuecomment-983672066
Unfortunately I had no chance to look at it. Everywhere where I'm using tls and http_async_client or http_client I'm sticking to libssl1.0.x. I'll try to look at it as I can. -- 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/2912#issuecomment-985292763
I got a bit of time to look at it on an Ubuntu 20.04 and it seems a similar case to one that was solved a while ago: * https://github.com/kamailio/kamailio/issues/2560#issuecomment-777590116 In short, kamailio has to be started with `--atexit=no` cli param. I added a note in the readme of the tls module: * https://github.com/kamailio/kamailio/commit/8dc18cab5bc32c1d34a9113242d230b7... I tested with the minimal config from the description of this issues, it crashes without `--atexit=no` and with it goes till errors related to not finding the certificate/key files. -- 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/2912#issuecomment-993524079
This fixes the issue for me. Thank you. -- 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/2912#issuecomment-994832500
Thanks for testing and reporting back! Probably the cli param has to be added to systemd units, iirc, it was done for rpms. I am closing it. -- 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/2912#issuecomment-994834594
Closed #2912. -- 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/2912#event-5771683856
neutrino38 left a comment (kamailio/kamailio#2912) I ran into the same issue. It seems to be linked to the fact that libssl >= 1.1 does its init on its own before the tls module is redirecting memory allocations to SHM - https://manpages.opensuse.org/Tumbleweed/openssl-3-doc/OPENSSL_init_ssl.33ss... -- Reply to this email directly or view it on GitHub: https://github.com/kamailio/kamailio/issues/2912#issuecomment-4592456728 You are receiving this because you are subscribed to this thread. Message ID: <kamailio/kamailio/issues/2912/4592456728@github.com>
participants (5)
-
Daniel-Constantin Mierla -
Emmanuel BUU -
Federico Cabiddu -
kdanderso -
Victor Seva