What might cause the following error as a result of a call to SSL_read:
error:140E0197:SSL routines:SSL_shutdown:shutdown while in init
I'm seeing this error reported well after the initial handshake should
have been completed, and before any call to SSL_shutdown on the SSL
object given to SSL_read. So, externally, there is no intention or
knowledge of SSL being actively shutdown or initialized at the time of
the read call. No other errors were reported before this one.
Occurrences of the error are uncommon, and I have not found a way to
reliably reproduce it. What could possibly be the cause of this error,
and how could it be prevented?
For additional context:
Using OpenSLL version 1.0.2l.
This error is seen on the client side, using TLS 1.0 (TLSv1_client_method).
Only memory BIO objects (BIO_s_mem) are set into the SSL object.
Looking at the code, this error (SSL_R_SHUTDOWN_WHILE_IN_INIT) is only
reported in SSL_shutdown, but I have not yet found how SSL_shutdown
might be called from SSL_read.
Additionally, the program in which this error occurs may be using
multiple SSL objects at a time, potentially with SSL objects on
different threads, but no SSL objects are shared between threads. The
SSL objects are created (via SSL_new) using the same shared context
object (SSL_CTX). Is there any chance the states or errors from
different SSL objects are interfering with each other?