cURL / Mailing Lists / curl-library / Single Mail

curl-library

Multi-threading problem

From: Torche Philippe <philippe.torche_at_nagra.com>
Date: Mon, 5 Aug 2002 16:18:21 +0200

When I run my multi-threading test code (see attached file), I have
approximately (0 to 10% probability) chance of having erroneous
transactions. The "Return" from curl_easy_perform is 7 (Connect failed).

Configuration :
-------------
  - Red Hat Linux 7.1
  - gcc 3.0
  - cURL version 7.9.8
Tested and had the same problem on Digital UNIX V4.0F (Rev. 1229) using cc
version DEC C V5.9-011

Compilation :
-----------
gcc -c -I./curl/include test_mt_cc_tran_2.c -o test_mt_cc_tran_2.o
gcc test_mt_cc_tran_2.o -Lcurl/lib/.libs -lcurl -lpthread -o
test_mt_cc_tran_2

Create a site returning a simple text, for me the site
"http://smspc19/CCTran/SimAuthorizeNet_2.php" returns "This transaction has
been approved.". Don't forget to change the code !

Test it :
-------
# Make 100 threads, each writing a log files in /tmp/test_mt_cc_tran_xxx
test_mt_cc_tran_2
# Or better
rm -f /tmp/test_mt_cc_tran_*; test_mt_cc_tran_2; ls -lSr
/tmp/test_mt_cc_tran_* | head

# Good file size will be 505(?) or 518, but when file size is 358 !?@?#!
# Don't hesitate to rerun program 2-10 times to have a error.

If I observe 2 errors in 100 threads, I can observe only 98 connections on
my apache access log.
The problem no longer arises if I use a lock mutex before
"curl_easy_perform(curl)" and unlock mutex after, but it's not acceptable
for me !

P.S. I also found this problem on Digital UNIX V4.0F, but with a higher
error rate (higher load on the machine maybe ?).

Please help me !

***
Philippe Torche
JLE informatique

-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf

Received on 2002-08-05