cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Multi Thread problem

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Fri, 20 Sep 2002 18:15:18 +0200 (MET DST)

On Fri, 20 Sep 2002, Chirag wrote:

You didn't mention version here, but I trust this is curl 7.9.8 we're talking
about?

> The problem is that this function is called by a number of threads (15
> threads to be precise). The whole code runs fine for some time, but then
> when there are say 5 requests at the same time to a same URL, and when it
> tries to retrive the content simultaneously, sometime in between i get a
> seg_fault.

Does the crash always happen when several threads get the same URL?

> I have put VERBOSE and here is where it gives me a seg_fault always...

And if you run the program with a debugger, can you get it to stop on the
offending line? If so, which one is it?

> By default i am giving a timeout of 60 secs. I dont know what cud be the
> problem.

That's only bad if the name lookup takes a long time since the abortion of
that is made with a signal and I don't know what a Solaris threaded program
does with it.

> I have tried all combination of increasing the timeout from 5 secs to 60
> secs.

What does it do without timeout?

> Also i have tried it with 5 threads to 13 threads but the crash is erratic.
> As u see from the VERBOSE below....when two or more threads have
> simultaneously got the content....my program goes down.

No, I didn't really see that. When and where exactly does it crash?

> http_body = (char *)strstr(chunk.memory, "\r\n\r\n");

This approach really isn't necessary. You can pass in a different "chunk"
pointer (or even callback function) for the headers when they are passed to
the callback.

I found no obvious flaws in the code.

-- 
 Daniel Stenberg -- curl related mails on curl related mailing lists please
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
Received on 2002-09-20