Hi,
I wonder if anyone can help? I am getting occasional core dumps
when using SSL_CTX_free() in a multi-threaded application.
Scenario:
---------
I have written an application to load test a secure web server using
OpenSSL 0.9.4 on Solaris 5.6 using Solaris threads.
I create a single SSL context (SSL_CTX*) structure to be shared by as
many concurrent threads as the user requests. Each thread then creates
it own SSL structure (SSL*) for use with its own socket. This in turn
increments the reference counter in the global context structure.
Just before a thread exits, it frees its own SSL structure with
SSL_free().
This decrements the reference counter in the context structure.
When all threads have completed, the master thread (main()) attempts to
free the global context structure with SSL_CTX_free().
Sometimes this works and sometimes it core dumps. What I have observed
with gdb is that when it dumps core, the reference count is wrong (0
instead
of 1). This suggests that perhaps SSL_free() isn't thread-safe as
somewhere
along the line an exiting thread decrements the reference counter twice!
Does this sound sensible, or have I got it wrong?
Has anyone seen this before / got a workaround?
(My workaround is just not to free the structure, but that's a hack!)
Thanks,
-- Chris
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Chris Bamford
Contract Web Developer
ntli
Email: [EMAIL PROTECTED]
Tel: 01256-752705
Mbl: 0467 844317
______________________________________________________________________
OpenSSL Project http://www.openssl.org
Development Mailing List [EMAIL PROTECTED]
Automated List Manager [EMAIL PROTECTED]