-
-
Notifications
You must be signed in to change notification settings - Fork 33.9k
Description
Documentation
Currently there is no documentation that tells anything about whether SSLContext is thread-safe or not and how it can be shared between different connections. Knowing how to share the SSLContext between different threads and connections is important for example to solve problems like this.
This issue has also come up here where the matter was clarified by @tiran in this comment:
SSLContextis designed to be shared and used for multiple connections. It is thread safe as long as you don't reconfigure it once it is used by a connection. Adding new certs to the internal trust store is fine, but changing ciphers, verification settings, or mTLS certs can lead to surprising behavior. The problem is unrelated to threads and can even occur in a single-threaded program.
I have reworked this statement into a PR so that it's generally available for future reference.