On Tue, 2008-04-08 at 03:35 -0500, Ion Scerbatiuc wrote:
> Hello!
> I wrote a multithreaded server using OpenSSL v 0.9.7a (running on a RH
> Enterprise Linux 2.6.9-55.0.2.ELsmp).
> The problem is my server is crashing at random times (it could stay
> alive for 24 hours or can crash within 4 hours). Inspecting the cores
> file I found that it crashes in the same location every time
>
> #0 0x00ba503f in CRYPTO_add_lock () from /lib/libcrypto.so.4
>
> I defined the two needed callbacks (according to crypto man page) like
> this:
>
> struct CRYPTO_dynlock_value
> {
> pthread_mutex_t mutex;
> };
>
> static pthread_mutex_t *mutex_buf = NULL;
>
> static void locking_function(int mode, int n, const char *file, int
> line)
> {
> if (mode & CRYPTO_LOCK) {
> pthread_mutex_lock(&mutex_buf[n]);
> } else {
> pthread_mutex_unlock(&mutex_buf[n]);
> }
> }
>
> static unsigned long id_function(void)
> {
> return ((unsigned long) pthread_self());
> }
Did you call CRYPTO_set_add_lock_callback() as well? You probably want
to set that and use the callback to do pthread_mutex_init().
Cheers,
Geoff
______________________________________________________________________
OpenSSL Project http://www.openssl.org
User Support Mailing List [email protected]
Automated List Manager [EMAIL PROTECTED]