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

__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    [EMAIL PROTECTED]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to