Thank you, Steven. That little change saved my day. It
seems to have fixed the crash problem.

Regards,
Jim
--- Steven Reddie <[EMAIL PROTECTED]> wrote:
> Have you used the following functions to register
> OpenSSL thread-safety
> callbacks:
> 
>       CRYPTO_set_locking_callback(locking_function);
>       CRYPTO_set_id_callback(id_function);
> 
> You need to supply your own locking_function() and
> id_function(), samples of
> which can be found in OpenSSL's mt/mttest.c,
> crypto/threads/mttest.c and
> crypto/threads/th-lock.c.
> 
> Regards,
> 
> Steven
> 
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf
> Of Jim Wang
> Sent: Thursday, 25 September 2003 8:31 AM
> To: [EMAIL PROTECTED]
> Subject: OpenSSL Thread-safe Issue ?
> 
> 
> Hi,
> 
> I have a server program using OpenSSL. It works well
> most of the time. However, when multiple clients
> connect to the server simultaneously, the server
> sometimes crashes with an access violation in the
> following code:
> 
> /* locked by SSL_CTX in the calling function */
> static void SSL_SESSION_list_remove(SSL_CTX *ctx,
> SSL_SESSION *s)
>       {
>       if ((s->next == NULL) || (s->prev == NULL)) return;
> 
>       if (s->next == (SSL_SESSION
> *)&(ctx->session_cache_tail))
>               { /* last element in list */
>               if (s->prev == (SSL_SESSION
> *)&(ctx->session_cache_head))
>                       { /* only one element in list */
>                       ctx->session_cache_head=NULL;
>                       ctx->session_cache_tail=NULL;
>                       }
>               else
>                       {
>                       ctx->session_cache_tail=s->prev;
>                       s->prev->next=(SSL_SESSION
> *)&(ctx->session_cache_tail);
>                       }
>               }
>       else
>               {
>               if (s->prev == (SSL_SESSION
> *)&(ctx->session_cache_head))
>                       { /* first element in list */
>                       ctx->session_cache_head=s->next;
>                       s->next->prev=(SSL_SESSION
> *)&(ctx->session_cache_head);
>                       }
>               else
>                       { /* middle of list */
> at this line---->     s->next->prev=s->prev;
>                       s->prev->next=s->next;
>                       }
>               }
>       s->prev=s->next=NULL;
>       }
> 
> 
> I built the OpenSSL libraries as multi-threaded, and
> in the server, I have a global SSL context, and
> service each OpenSSL request by a separate thread. I
> am wondering if I need to lock any global data in
> order to handle many concurrent requests. The crash
> appears to be thread-safty related.
> 
> Thank you, and your help is greatly appreciated !
> 
> Jim
> 
>
______________________________________________________________________
> OpenSSL Project                                
> http://www.openssl.org
> User Support Mailing List                   
> [EMAIL PROTECTED]
> Automated List Manager                          
[EMAIL PROTECTED]


__________________________________
Do you Yahoo!?
The New Yahoo! Shopping - with improved product search
http://shopping.yahoo.com
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    [EMAIL PROTECTED]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to