cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: multihomed connections

From: Dan Fandrich <dan_at_coneharvesters.com>
Date: Tue, 8 Jun 2004 11:38:05 -0700

On Tue, Jun 08, 2004 at 08:18:40PM +0200, Gisle Vanem wrote:
> The other "bug" in libcurl is not a bug at all, but rather inconsitent
> behaviour depending on which resolver is used.
>
> Without C-ares (i.e. USE_THREADING_GETADDRINFO):
>
> >set CURL_TRACE=1
> >curl -v4 http://ubr4-ca5-0-sec.landg1.lb.home.nl
> * Couldn't find host ubr4-ca5-0-sec.landg1.lb.home.nl in the .netrc file, using defaults
> 416: not yet
> 139: dump_addrinfo:
> fam 2, CNAME <none>, 10.221.110.1
> fam 2, CNAME <none>, 82.72.140.1
> fam 2, CNAME <none>, 10.243.112.1
> fam 2, CNAME <none>, 82.73.204.1
> fam 2, CNAME <none>, 217.121.93.1
> fam 2, CNAME <none>, 217.122.53.1
> fam 2, CNAME <none>, 217.123.132.1
> 353: getaddrinfo_thread() status 0, thread retval 0, 361: elapsed 15 ms
> * About to connect() to ubr4-ca5-0-sec.landg1.lb.home.nl port 80
> * Connect failed; Connection refused
> * Closing connection #0
> curl: (7) Connect failed; Connection refused
>
> Okay, the "refused" came from the last IP. Using tcpdump, I see curl
> tries the addresses in the above order. But with a C-ares version, the
> result is "timed out". Since the last IP it tried was 10.221.110.1.
> It would be nice if libcurl could tell us all the IP it tried and the result of
> each failed attempt.
>
> I.e. C-ares returns a completely different IP-order compared to what getaddrinfo()
> says. It looks like the DNS for this host is misconfigured too. Isn't addresses
> supposed to be listed in *prefered* order?

If the DNS server is configured for round-robin, then the "preferred"
order is to balance requests evenly over the various addresses. The
preferred address could be different each time.

> BTW. try "adig www.cnn.com" and watch the IP-order changes constantly.
> Whereas the dig or host programs gives a more stable list of IPs.

I'll bet adig does a new DNS request each time, whereas dig and host return
a cached result.

>>> Dan

-- 
http://www.MoveAnnouncer.com              The web change of address service
          Let webmasters know that your web site has moved
Received on 2004-06-08