cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Openssl crashing when linked against curl(multithreaded setup) in AIX 64 bit platform

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Mon, 10 Feb 2014 13:41:02 +0100 (CET)

On Mon, 10 Feb 2014, Arunav Sanyal wrote:

> In here you are defining curl_mutex_t as pthread_mutex for posix complaint
> platforms and CRITICAL_SECTION object for windows. So this entails that curl
> will be using these libraries for any critical sections inside their code.

Yes - if you asked for it.

> This also means curl is forcing pthread on nix platforms even when native
> libraries might outperform it. (I am guessing optimized thread safety is a
> concern here).

Yes - if you asked for it.

> Assume that there is a user who is not proficient in c and does not dabble
> with curl source code and just builds curl with openssl. They will find
> intermittent crashes on different platforms due to openssl not being thread
> safe and might lose patience and stop using curl all together.

True that is a risk.

But this has been the documented functionality and "restriction" since forever
and quite a lot of users seem to have figured that out anyway. Of course quite
a few probably don't use it multi-threaded.

> Is it not a viable idea that the callback handlers to openssl use
> curl_mutex_t and its acquire and release method to ensure out of the box
> functionality for curl?

It is. I wouldn't mind offering a way for applications to do pthread-mutex
callbacks with libcurl. They should of course then be done properly (or not)
depending what the specific SSL backend needs that libcurl is built to use.
I'm not sure exactly how/if that should be done by default or how this would
be setup, but those are details that can be worked out.

For me, the primary motivation to offer them within libcurl is to make the
libcurl API more SSL backend agnostic.

But note: if you or anyone else wants to see this happen anytime soon, I think
you need to be prepared to start working on it as this is not anything I plan
to do myself in the near term.

-- 
  / daniel.haxx.se
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2014-02-10