cURL / Mailing Lists / curl-library / Single Mail

curl-library

libcurl openssl thread crash - Windows XP

From: Matt Veenstra <matts_lists_at_tribalmedia.com>
Date: Wed, 29 Apr 2009 16:22:26 -0700

Hi there,
I have one client machine that is always crashing when we start multiple
threads with each thread using separate easy handles with OpenSSL. I
tracked this down to each thread calling Curl_ossl_seed() at the same time,
with some fun remote WinDBG sessions.

The call stack basically looks like this.

Heap32Next() // crash.
RAND_poll();
RAND_screen();
ossl_seed();
Curl_ossl_seed();
ossl_connect_step1();
...

I have the proper OpenSSL thread call backs in place for Windows setting
CRYPTO_set_locking_callback() as documented. I call curl_global_init() at
the start of my app. There is an option to build OpenSSL to NOT use
RAND_screen(). I did this but still had the crash.

Removing the seed call (which I assume is used for the salt) solves the
crash. Should the seed be set in curl_global_init()?

I am using a slightly old version of libcurl (7.18.0) and OpenSSL
0.9.8.7(g). I looked at the changes since then and nothing related to the
seed has changed in the current version.

Does anyone have input into this? This is a not a common bug. There are
over many other copies of the app running that do NOT have this problem. It
only happens when spawning a group of downloads all at once.

Thanks for the feedback. Hopefully this can help someone else as well.

Matt
tribalmedia
Received on 2009-04-30