Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.

release/2.0: Use a shared MultiAgent in CurlHandler when using LibreSSL backend on macOS #22243

Conversation

stephentoub
Copy link
Member

LibreSSL needs locks initialized in order to be used safely from
multiple threads, which happens when multiple HttpClients are used. But
we don't currently have a good way to perform that initialization as we
do for OpenSSL. As a workaround, add a shared MultiAgent that's
initialized when LibreSSL is used on macOS, and use that same MultiAgent
from all CurlHandler instances rather than giving each their own. Since
MultiAgent is 1:1 with a thread, all HttpClient's will then end up
sharing the same libcurl event loop thread, and we'll serialize all of
our interactions with libcurl and thus hopefully with LibreSSL.

cc: @bartonjs, @geoffkizer, @nguerrera, @Petermarcu

… macOS

LibreSSL needs locks initialized in order to be used safely from
multiple threads, which happens when multiple HttpClients are used.  But
we don't currently have a good way to perform that initialization as we
do for OpenSSL.  As a workaround, add a shared MultiAgent that's
initialized when LibreSSL is used on macOS, and use that same MultiAgent
from all CurlHandler instances rather than giving each their own.  Since
MultiAgent is 1:1 with a thread, all HttpClient's will then end up
sharing the same libcurl event loop thread, and we'll serialize all of
our interactions with libcurl and thus hopefully with LibreSSL.
@Petermarcu Petermarcu merged commit 49f932d into dotnet:release/2.0.0 Jul 14, 2017
@stephentoub stephentoub deleted the curlhandler_sharedmultiagent_release20 branch July 14, 2017 01:47
@karelz karelz modified the milestone: 2.0.0 Jul 14, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
6 participants