cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: multi-threads SFTP in libcurl

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Thu, 11 Nov 2010 09:50:41 +0100 (CET)

On Thu, 11 Nov 2010, CHEN Xiaolei A wrote:

> When using libcurl SFTP to download files in multi-threads, I encountered
> a problem: the concurrent thread number can not be greater than 20, or else
> core dump will probably occur.

> (2) Launch 20+ threads to do SFTP, and in each thread, download a big size
> (12M) file for 20 times
> Result: core dumped very soon, and in some threads,
> CURLE_FAILED_INIT occurred.

So what does a backtrace of such a crash look like?

> (1) When we check core problem, we found that it may be caused by openssl,
> is there any method to make openssl thread-safe?

Yes, as documented
(http://www.openssl.org/docs/crypto/threads.html#DESCRIPTION) you MUST set the
openssl mutex callbacks. See for example this:
http://curl.haxx.se/libcurl/c/threaded-ssl.html

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