We have observed this error when using multiple tls connecitons with openssl version 1.0.0. This is because CRYPTO_set_id_callback() is not used in tls_init_locks(). The kamailio code has following comment
/* thread id callback: not needed because ser doesn't use thread and
* openssl already uses getpid() (by default)
* CRYPTO_set_id_callback(id_f);
As per the documentation openssl is not using getpid anymore , it is valid only till 0.9.
the openssl man page says
If the application does not register such a callback using CRYPTO_THREADID_set_callback(), then a default implementation is used - on Windows and BeOS this uses the system's default thread identifying APIs, and on all other platforms it uses the address of errno.
In multi process environment Errno can points to same virtual address. So we need to use getpid() in CRYPTO_set_id_callback(id_f)
unsigned long id_f()
{
return my_pid();
}
Please read the link below for refrence