cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: multithreading problem with libcurl

From: Jean-Philippe Barrette-LaPierre <jpb_at_rrette.com>
Date: Sun, 1 Jun 2003 13:40:16 -0400

On Sunday 01 June 2003 05:41 am, Konstantin Schauwecker wrote:
> Hello everybody
>
> I have some strange problems when using libcurl in multiple threads. I've
> spend days of debugging and modifying my source, and now I'm completely
> helpless :-(
> I have an application which uses 10 threads (I had the problem with lower
> counts of threads too). Each thread calls a curl_easy_init to get a curl
> handle. All threads are doing constantly HTTP requests.
>
> Now my Problems:
>
> On Linux:
> The program runs fine for a few minutes, but then it crashes with a
> segmentation fault. Valgrind told me, that the reason for crashing is
> inside of libcurl. Here the output of valgrind:

which version of curl are you using?

>
> ==1487== valgrind's libpthread.so: KLUDGED call to: siglongjmp (cleanup
> handlers are ignored)
> ==1487== Invalid read of size 4
> ==1487== at 0x40235303: Curl_resolv (hostip.c:242)
> ==1487== Address 0x41B0C3B0 is on thread 1's stack
> ==1487==
> ==1487== Invalid read of size 4
> ==1487== at 0x4023B01B: Curl_failf (sendf.c:154)
> ==1487== Address 0x10 is not stack'd, malloc'd or free'd
>
> I thougth this might be a problem of setting the wrong options. So I tried
> to remove the calls of curl_easy_setopt to a minimum (I already tried
> reducing all code to a minimum *g*), but it didn't help.
>
> On Windows:
> On Windows the program doesn't crash (I even used a memory debugger too),
> but it shows some other strange behaviour: First everything works fine too,
> but then the CPU load jumps to 100% and won't come down until I terminate
> all threads. As far as I could figure out, the calls (or at least one call)
> of curl_easy_perform must produce the high CPU load. But none of them hangs
> up (just getting extremely slow).
>
> All these problems are gone, if I reduce the number of threads to 1. I hope
> somebody of you has an idea what I could do.
>
> Konstantin Schauwecker
>
>
> -------------------------------------------------------
> This SF.net email is sponsored by: eBay
> Get office equipment for less on eBay!
> http://adfarm.mediaplex.com/ad/ck/711-11697-6916-5

-------------------------------------------------------
This SF.net email is sponsored by: eBay
Get office equipment for less on eBay!
http://adfarm.mediaplex.com/ad/ck/711-11697-6916-5
Received on 2003-06-01