Hi daniel, We have already set the openssl mutex callbacks as the attachment, but still failed.
It cored in the following thread. It seems that libssh2 access already free memory when call crypt_encrypt. The core trace: ----------------- lwp# 2 / thread# 2 -------------------- 00000000 ???????? (1e5638, ff0ffd78, 0, 196310, 0, 0) ff0dce7c crypt_encrypt (1956a8, 196310, 195734, 0, 0, 1e5630) + 24 ff0fb6ac decrypt (1956a8, 1957d0, 1d12fb, 23a0, 3ffc, 1957d0) + d4 ff0fc2d0 _libssh2_transport_read (1956a8, 23b0, ff1011e8, 10, 0, 1957d0) + 6e0 ff0da5a0 _libssh2_channel_read (1a4460, 0, fea7b8f8, 4, 1809f8, 0) + 88 ff0ef870 sftp_packet_read (1a7898, 65, 3, fea7b9f8, fea7ba0c, 1956a8) + a8 ff0eff30 sftp_packet_requirev (1a7898, 2, ff1007e2, 3, fea7b9f8, fea7ba0c) + c0 ff0f1f3c sftp_read (1dbcb0, b4efc, 4000, 0, 0, 0) + 34c ff0f2298 libssh2_sftp_read (1dbcb0, b4efc, 4000, 0, 0, 0) + 18 ff177640 sftp_recv (1872d8, 0, b4efc, 4000, fea7bb80, 0) + 30 ff138064 Curl_read (1872d8, 43, b4efc, 4000, fea7bc44, 0) + 27c ff153a70 readwrite_data (b49a0, 1872d8, b49b8, fea7bce4, fea7bd7c, 0) + 188 ff154d60 Curl_readwrite (1872d8, fea7bd7c, 3e8, fea7bd80, 1809f8, d) + 180 ff155fe4 Transfer (1872d8, fea7be04, ff161258, ff161330, ff1347b0, fec35578) + 64c ff156974 Curl_do_perform (b49a0, ff161258, ff161330, ff1347b0, febc1f74, fec303a8) + 174 ff156d78 Curl_perform (b49a0, 2711, fea7bf44, 2c, 8, fec35578) + 20 ff157adc curl_easy_perform (b49a0, 2711, fea7bf68, 90d68, ff15791c, c9ad8) + 184 00011a18 void*test_muti(void*) (42260, fea7c000, 0, 0, 117b8, 1) + 260 febc8a20 _lwp_start (0, 0, 0, 0, 0, 0) Is there anything more we can do? Thanks a lot. Best Regards, Atlantis -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Daniel Stenberg Sent: 2010年11月11日 16:51 To: libcurl development Subject: Re: multi-threads SFTP in libcurl 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
libcurl_m.cc
Description: libcurl_m.cc
------------------------------------------------------------------- List admin: http://cool.haxx.se/list/listinfo/curl-library Etiquette: http://curl.haxx.se/mail/etiquette.html
