cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: About libcurl HTTPS and Multithreading crash

From: Dave Reisner <d_at_falconindy.com>
Date: Sun, 4 Mar 2012 09:11:12 -0500

On Sun, Mar 04, 2012 at 02:27:24PM +0800, Woods wrote:
> Hi
>
> I asked this issue months back, which is about libcurl crashes when I
> request https urls in multithreading manner.
> According to your advice, I read through the multithreading and init
> global sections in the tutorial, and they seem do not solve my
> problem. I have tested the code, attached below, on Centos and Mac
> platform, both crashes after I request over few hundreds of urls with
> a pool of threads in size of 100 to 200 threads. In contract, if the
> code only request Http urls, there is no such problem, it is stable.
> I hope you can give me some advice on this, or if this is a know issue
> in libcurl. Thank you!
>
> Woods

There's no shortage of documentation about this. You need to employ
locking callbacks for openssl:

http://curl.haxx.se/libcurl/c/libcurl-tutorial.html#Multi-threading

There's even an example of how to do this:

http://curl.haxx.se/libcurl/c/threaded-ssl.html

Regards,
Dave

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2012-03-04