cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: intermittent "Could not resolve host"

From: Michael Wood <esiotrot_at_gmail.com>
Date: Tue, 19 May 2009 11:42:59 +0200

On Mon, May 18, 2009 at 8:29 PM, Tiberiu Motoc <tiberiu.motoc_at_gmail.com> wrote:
> Hi,
>
> Very rarely (I estimate 1/250 times) I get the following error from
> Curl: "Could not resolve host: [URL_host_name] (Domain name not
> found)". I always access the same URL. I don't use a proxy, nor do I
> use SSL. There is a company firewall setup, but I don't have access to
> it. Today, there happened to be a problem with the firewall (I don't
> know the details) and I've seen this error being generated more often.
> I just don't know how to debug this. Does anyone have any idea why this happens?

It could be your DNS server is sometimes slow to respond to a query or
the query or reply gets eaten by the firewall or some other overloaded
device between you and the DNS server.

Try running a packet sniffer on your machine and watch for DNS queries
and replies. When you get one of these errors, examine the packet
sniffer logs to see if the reply from the DNS server went missing or
took longer than usual.

You could also try doing a bunch of DNS lookups using some other tool
to see if it has the same problem, which would imply it is not
libcurl's fault.

e.g.:
$ while :; do host your-server.example.com; sleep 1; done | tee
/tmp/dnslookups.log

But maybe without the "sleep 1", depending on how often your
libcurl-based program normally tries to retrieve the URL. (Leaving
out the sleep may or may not cause your DNS server admin to get
upset.)

-- 
Michael Wood <esiotrot_at_gmail.com>
Received on 2009-05-19