cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: weird timings from curl_easy_getinfo

From: Oleg Bartunov <oleg_at_sai.msu.su>
Date: Thu, 9 Aug 2001 15:50:26 +0300 (GMT)

From what I know it's very difficult (if possible) to handle
signals in multithreaded applications. But this is far from my knowledge.
Looks that libcurl needed too much work to be thread-safe

btw, all experiments I did under Linux, which uses user space threads,
so I just tried FreeBSD. I compiled libcurl and my program with following
options:
CFLAGS= -D_REENTRANT -D_THREAD_SAFE
LDFLAGS=-pthread

I got segmentation fault when I run program as
./a.out < URL, where URL is rather big file with > 100,000 URLS

0 0x6807e295 in Transfer () from /usr/local/lib/libcurl.so.2
(gdb) l
95 return NULL;
96 }
97
98
99 int main(int argc, char **argv)
100 {
101 pthread_t tid[NTHREADS];
102 int i, error;
103
104 curl_global_init(CURL_GLOBAL_ALL);
(gdb) bt
#0 0x6807e295 in Transfer () from /usr/local/lib/libcurl.so.2
#1 0x6807f8f3 in Curl_perform () from /usr/local/lib/libcurl.so.2
#2 0x68080027 in curl_easy_perform () from /usr/local/lib/libcurl.so.2
#3 0x8048b39 in pull_one_url () at tt.c:74
#4 0x6809eac3 in _thread_start () from /usr/lib/libc_r.so.4
#5 0x0 in ?? ()
(gdb)

If I cut big URL file to 10 urls, then program runs and produces the same
weird timings.

I'll try your suggestion later

        Regards,
                Oleg

On Thu, 9 Aug 2001, Daniel Stenberg wrote:

> On Wed, 8 Aug 2001, Oleg Bartunov wrote:
>
> > I have in my program:
> > curl_easy_setopt(curl, CURLOPT_TIMEOUT, 100);
> > curl_easy_setopt(curl, CURLOPT_CONNECTTIMEOUT,200);
> >
> > Look at numbers - NAMELOOKUP_TIME = 112.725 seconds !
>
> Yes, but the timeout on name lookups are (still) signal-based and I really
> don't know if/how that works in multi-threaded cases.
>
> Do those timeout settings actually affect anything in this case?
>
> > When I did the same operation from command line using curl:
> > curl -K ./CONF http://99.tsu.ru:80/
> > I get normal numbers
> > 23.589|0.002|9.484|9.484|8227|348.767
>
> Well, then it is a pretty different story, isn't it? I have no idea really
> how the scheduling is done in your system when you use 100 threads, but in
> theory it is certainly possible that one thread takes a long time.
>
> What if you add code to your program that measures the total time outside the
> curl_easy_perform() call? The numbers should be very close if libcurl is
> correct.
>
>

        Regards,
                Oleg
_____________________________________________________________
Oleg Bartunov, sci.researcher, hostmaster of AstroNet,
Sternberg Astronomical Institute, Moscow University (Russia)
Internet: oleg@sai.msu.su, http://www.sai.msu.su/~megera/
phone: +007(095)939-16-83, +007(095)939-23-83

_______________________________________________
Curl-library mailing list
http://curl.haxx.se/libcurl/
Received on 2001-08-09