cURL / Mailing Lists / curl-library / Single Mail

curl-library

Threaded resolver provides bad file descriptor on Windows

From: Brian Makin <makin_at_vivisimo.com>
Date: Fri, 02 Jul 2010 10:35:22 -0400

In commit 483ff1ca, the following code was added to lib/hostthre.c:

> /* This socket is only to keep Curl_resolv_fdset() and select() happy;
> * should never become signalled for read since it's unbound but
> * Windows needs at least 1 socket in select().
> */
> td->dummy_sock = socket(AF_INET, SOCK_DGRAM, 0);
> if (td->dummy_sock == CURL_SOCKET_BAD)
> goto err_exit;

As the code and comment state, this creates a dummy socket that is then
returned from curl_multi_fdset via Curl_resolv_getsock.

Since no data will ever become available on this socket, performing a
select() on the fdset returned by curl_multi_fdset will simply timeout.
This means that code and servers that previously were fairly responsive
now have essentially a forced sleep of the select timeout period.

Even the provided example code (docs/examples/multi-single.c) exhibits
this problem. The select timeout is set to one second, so each run of
this program will now take a minimum of one second.

We believe that this issue first manifested in curl 7.20.0.

Is this a known issue?
If so, what is the recommended workaround?
If not, what further information can we provide?

We would be happy to produce a patch, but would appreciate guidance on
the desired method of addressing the issue.

-- 
BRIAN MAKIN
Senior Software Engineer
makin_at_vivisimo.com
Vivisimo [Search Done Rightâ„¢]
1710 Murray Avenue
Pittsburgh, PA 15217 USA
tel: +1.412.422.2499
vivisimo.com
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2010-07-02