Skip to content

Add thread-safety clarifications to the SSLContext documentation #118596

@mm-matthias

Description

@mm-matthias

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:

SSLContext is 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.

Linked PRs

Metadata

Metadata

Assignees

Labels

docsDocumentation in the Doc dir

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions