cURL / Mailing Lists / curl-library / Single Mail


Re: problem with simultaneous sftp connections.

From: michele <>
Date: Wed, 10 Aug 2011 17:14:16 +0200

Thank you for the quick answer.
I made the following changes to my program:
At the very beginning of the application I setup cURL and the locks:
     curl_global_init( CURL_GLOBAL_DEFAULT);
     int threadLockResult = thread_setup();

At the end of the application I clean up both:
     int threadLockResult = thread_cleanup();

But the result is the same segfault:

(gdb) where
#0 0x0000000000000000 in ?? ()
#1 0x0000003992a1e883 in ?? () from /usr/lib64/
#2 0x0000003992a1c7b9 in ?? () from /usr/lib64/
#3 0x0000003992a0591a in ?? () from /usr/lib64/
#4 0x0000003992a16475 in libssh2_sftp_write () from /usr/lib64/
#5 0x000000306923b4e3 in Curl_sftp_send () from /usr/lib64/
#6 0x0000003069217a65 in Curl_write () from /usr/lib64/
#7 0x000000306922b1c7 in Curl_readwrite () from /usr/lib64/
#8 0x000000306922bca8 in Curl_perform () from /usr/lib64/

(thread_setup and thread_cleanup are the two callbacks copied from
opensslthreadlock sample).


On 08/10/2011 02:40 PM, Daniel Stenberg wrote:
> On Wed, 10 Aug 2011, michele wrote:
>> I receive the following segmentation fault when I try to send more
>> different files simultaneously (via sftp):
> ...
>> I noticed that, when I use OpenSSL and cURL in a multithreaded
>> environment, I must define the callback void lock_function(..) and
>> void unlock_function(..) in order to avoid problems like this. Is it
>> correct?
> Yes, that is correct. And chances are your libssh2 is also using
> OpenSSL and needs the same mutex callbacks.
>> How can I use these two callbacks?
> Check out this example:

ATTENZIONE: le informazioni contenute in questo messaggio sono da considerarsi confidenziali ed il loro utilizzo e' riservato unicamente al destinatario sopra indicato. Chi dovesse ricevere questo messaggio per errore e' tenuto ad informare il mittente ed a rimuoverlo definitivamente da ogni supporto elettronico o cartaceo.

WARNING: This message contains confidential and/or proprietary information which may be subject to privilege or immunity and which is intended for use of its addressee only. Should you receive this message in error, you are kindly requested to inform the sender and to definitively remove it from any paper or electronic format.
List admin:
Received on 2011-08-10