Curt Sampson <c...@cynic.net> said:
> On 2012-09-25 16:48 +0200 (Tue), sa...@zxid.org wrote:
> 
> > ...I get an abort with following error
> > int_thread_release, bad reference count
> > 
> > 3. I have multiple worker threads synchronized such that one thread
> >    may be reading while other is writing, but never two threads
> >    simultaneously reading or simultaneously writing.
> 
> According to the OpenSSL FAQ:
> 
>     1. Is OpenSSL thread-safe?
> 
>     Yes (with limitations: an SSL connection may not concurrently be
>     used by multiple threads).
> 
> I may be wrong here, but it seems to me that if you have one thread
> reading and a different thread writing, that's two threads concurrently
> using one connection.
> 
> And "underneath the covers," as it were, both threads may be both
> reading and writing, since a read or write to an OpenSSL handle can
> translate to both reads and writes on the underlying TCP handle.

I have in past, say 2008 vintage OpenSSL, used OpenSSL in this way
without problem.

Basically the logic is that the server will not
try to write payload data before it gets request from client,
therefore during the accept processing there is effectively only
one thread, the reader, that will do both reading and writing.

Once you are past the accept handshake, the reading and writing are
unidirectional per thread and this should be possible to make
work. But of course it is possible that a new handshake happens
in midconnection. I wonder if there is any way to prevent that.

I'll try adding light debug prints and more locks to see if
your theory is right (problem with debug prints is the
heisenbug effect).

Cheers,
--Sampo

> cjs
> -- 
> Curt Sampson         <c...@cynic.net>         +81 90 7737 2974
> 
> It is easier to write an incorrect program than understand a correct one.
>     --Alan Perlis, Epigrams on Programming (#7)
> ______________________________________________________________________
> OpenSSL Project                                 http://www.openssl.org
> User Support Mailing List                    openssl-users@openssl.org
> Automated List Manager                           majord...@openssl.org
> 
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    openssl-users@openssl.org
Automated List Manager                           majord...@openssl.org

Reply via email to