Thanks for the reply.  I am already using both of your suggestions.  The
locking callbacks appear to be working fine. Here's why I think that.

First, I am cleaning up each thread as it exits by issuing the following
sequence of calls (is this what I SHOULD be doing?):

                int iErr = ERR_get_error ();
                ERR_error_string (iErr, buf);
                ERR_reason_error_string (iErr);
                ERR_remove_state (0);

If I remove this group of calls, I can process hundreds of thousands of
connections without a hitch (except for memory leaking).  These "hundreds of
thousands" of connections that I mention are across hundreds of thousands of
threads, too. [Each new connection gets a new thread, and my test software
strives to keep 60 of them alive at all times]  That all seems to indicate
that the threading and locking are working fine.  As soon as I put the
"cleanup" calls back in, though (as mentioned above), I get a crash as noted
in the stack trace and message below.

Any idea what's wrong?

Bill Rebey

-----Original Message-----
From:   [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]
Sent:   Thursday, July 13, 2000 4:54 PM
To:     [EMAIL PROTECTED]; Bill Rebey
Subject:        Re: Bus Error

Bill Rebey <[EMAIL PROTECTED]>:

> On a SPARC running Solaris 2.7, my application crashed with a bus error.
> 
> Here is the stack trace form the core:
> 
> [1] lh_retrieve(0x63150, 0x522c7, 0xf4624, 0x61737465, 0xcbb0588c,
0xf8220),
> at 0x61be0
> [2] ERR_get_state(0xdf000, 0xc5cf8, 0x6523, 0x0, 0xef5d5250, 0x3466), at
> 0x63340
> [3] get_error_values(0x1, 0x0, 0x0, 0x0, 0x0, 0x0), at 0x62b68
[...]
> Significant notes:
> 
> This code didn't cause a problem until about the 8,000th  call to it (as
you
> can see the code is in a destructor for a Thread class that I wrote;
about
> 8,000 threads were successfully started and stopped before this one
> crashed).
> 
> The SSL library was never initialized.  Why??  Because in my little world,
> sockets know about SSL things; threads do not. SSL has nothing to with
> threads, as threads can be used for anything.  [...]

If you use OpenSSL with multi-threading, you *have* to provide
locking callback functions for synchronizing access to global
(and shared) data structures.
See <URL: http://www.openssl.org/docs/crypto/thread.html>.

Also you should call ERR_remove_state(0) in each thread that is about
to be terminated, but failure to do so should only result in memory
leaks and not in a crash.
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [EMAIL PROTECTED]
Automated List Manager                           [EMAIL PROTECTED]
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [EMAIL PROTECTED]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to