cURL / Mailing Lists / curl-library / Single Mail

curl-library

Segfault running a threaded application

From: Abe Lederman <abe_at_deepwebtech.com>
Date: Sun, 24 Nov 2002 11:08:44 -0700

Hi,
 
I've been looking at porting a libwww application to libcurl and I have
run into a problem with a test program that I wrote that tests curl in a
multi-threaded environment.
 
My test program is running on Solaris 8, uses pthreads, and version
7.10.2 of libcurl.
 
My test program takes a list of URLs, most of which cause queries to be
executed, in either GET or POST and gets the URL in a thread.
 
My main program monitors completion of the GET or POST and starts a new
thread when a slot is available.
 
Initially I get a curl handle for each of the threads that I am going to
run concurrently, and I keep reusing it.
 
I have timeouts set at 30 seconds, and I'm getting lots of timeouts (10
- 20%) - this is expected.
 
I have set CURLOPT_DNS_USE_GLOBAL_CACHE to false (0). I wasn't sure if
this is the default.
 
Before making my program multithreaded I was able to retrieve thousands
of these URLs with no problems.
 
I'm currently running my test program with 6 concurrent threads, and it
usually fails after getting about 100 URLs.
 
When I ran the test program on a different set of URLs, one local URL
and one URL that would always time out, repeatedly trying to retrieve
between those and running with up to 12 threads I could not get my
application to segfault.
 
One example stack trace where I got the segfault is:
 
#0 0x21fcc in Curl_llist_remove (list=0xcbff0, e=0xcfb08, user=0xd0cf8)
at llist.c:126
#1 0x13c5c in Curl_hash_clean_with_criterium (h=0xd0cf8,
user=0xee007920,
    comp=0x13dc8 <hostcache_timestamp_remove>) at hash.c:271
#2 0x13e20 in hostcache_prune (hostcache=0xd0cf8, cache_timeout=60,
now=1038159746)
    at hostip.c:189
#3 0x13f60 in Curl_resolv (data=0xb23b0, hostname=0xd9ad0
"www.deepwebtech.com",
    port=80) at hostip.c:280
#4 0x18474 in CreateConnection (data=0xb23b0, in_connect=0xee007c1c) at
url.c:2675
#5 0x187a0 in Curl_connect (data=0xb23b0, in_connect=0xee007c1c) at
url.c:2822
#6 0x210bc in Curl_perform (data=0xb23b0) at transfer.c:1561
#7 0x1360c in curl_easy_perform (curl=0xb23b0) at easy.c:245
#8 0x13210 in executeUrl (curlData=0xb1950) at geturls.c:100
 
Let me know what else I could to help you debug this problem.
 
Thanks,
 
Abe
 
 
 

-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
Received on 2002-11-24