Is Python SSL API thread-safe?

Jon Ribbens jon+usenet at unequivocal.eu
Sun Jan 22 15:55:16 EST 2017


On 2017-01-22, Grant Edwards <grant.b.edwards at gmail.com> wrote:
> Is the Python SSL API thread-safe with respect to recv() and send()?
>
> IOW, can I have one thread doing blocking recv() calls on an SSL
> connection object while "simultaneously" a second thread is calling
> send() on that same connection object?

I think this question is equivalent to asking "is OpenSSL thread-safe",
the answer to which would appear to be "yes":
https://www.openssl.org/docs/man1.0.2/crypto/threads.html
(the necessary functions mentioned on that page, threadid_func and
locking_function are indeed set by Python).


More information about the Python-list mailing list