[Python-Dev] OpenSSL thread safety when reading files? (original) (raw)

Bill Janssen janssen at parc.com
Sat Sep 8 00:10:10 CEST 2007


I'm seeing a number of malloc (actully, free) errors, now that I'm pounding on the OpenSSL server/client setup with lots of server threads and client threads. They all look like either

The issue seems to be that we assume OpenSSL is thread-safe (that is, we call Py_BEGIN_ALLOW_THREADS / Py_END_ALLOW_THREADS), but the _ssl.c code never did what was necessary to support that assumption. See http://www.openssl.org/docs/crypto/threads.html#DESCRIPTION.

My analysis is that we need to add lock and unlock functions to the OpenSSL initialization code we currently use, which looks like this:

/* Init OpenSSL */
SSL_load_error_strings();
SSLeay_add_ssl_algorithms();

Or, just not allow threads, which seems wrong.

Bill



More information about the Python-Dev mailing list