cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Fix for known bug #64 / simplification of hostthre.c

From: Jamie Lokier <jamie_at_shareable.org>
Date: Mon, 7 Sep 2009 12:06:25 +0100

Daniel Stenberg wrote:
> On Sun, 6 Sep 2009, Constantine Sapuntzakis wrote:
>
> >This patch gets rid of most of the synchronization and just waits for the
> >resolver thread to exit. The benefit is simplicity.
> >
> >This patch does not really support timeout of async name lookups -- the
> >patch will eventually wait for the thread to exit in
> >Curl_destroy_thread_data if it hasn't earlier.
>
> Lots of people and apps use timeouts so not supporting those is a real
> problem.
>
> So what happens if we have a time-out of 1ms, a very slow DNS that takes a
> full second to respond and we ask for a file on such a host 1000 times in a
> loop? Will we then have 1000 threads waiting to die?

I would think you have 3000 open file descriptors and a DNS
implementation which breaks because it's using select() and FD_SETSIZE
== 256 in the DNS code to worry about first :-)

But anyway, it's another reason to use an external resolver process,
ugly though that is: you can safely kill an external process when you
no longer need it, instead of waiting for it to finish.

-- Jamie
Received on 2009-09-07