cURL / Mailing Lists / curl-library / Single Mail

curl-library

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

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Mon, 7 Sep 2009 14:23:50 +0200 (CEST)

On Mon, 7 Sep 2009, Jamie Lokier wrote:

>>
>> 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 :-)

Ah yes, on windows the defalt number of concurrent open sockets is usually a
lot less than other systems too (still 64?) so I bet this would break long
before 1000.

> 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.

True. But also, it would probably be enough if we could ask the resolver
thread to kill itself when convenient and then just leave it there to die in
its own pace, as long as it checks that "kill me" flag often enough. Then we
shouldn't risk leaks because of a killed thread.

-- 
  / daniel.haxx.se
Received on 2009-09-07