cURL / Mailing Lists / curl-library / Single Mail

curl-library

wrong timeout in Curl_wait_for_resolv [ was Re: Ares Issue, Please Help!]

From: Dirk Manske <dm_at_sysformance.com>
Date: Wed, 31 Mar 2004 03:15:52 +0200

On Tuesday 30 March 2004 18:06, Dirk Manske wrote:
> On Tuesday 30 March 2004 10:11, Daniel Stenberg wrote:
> > On Mon, 29 Mar 2004, Roy Shan wrote:
> >
> > > After adding debugging code as you advised, I did observe that handles got
> > > stuck in the state of CURLM_STATE_WAITRESOLVE.
> >
> > Ok, having that verified it is pretty obvious that we don't handle name lookup
> > timeouts properly in there. I was naively assuming that ares took care of
> > those automatically.
> There is another problem, I've notice that I get timeouts where the timeout time isn't
> really reached.

I found the reason.

In Curl_wait_for_resolv the timeout is set by following code:

      store.tv_sec = (int)(timeout - elapsed);
      tvp = ares_timeout(data->state.areschannel,
                       &store, &tv);
      count = select(nfds, &read_fds, &write_fds, NULL, tvp);

After executing ares_timeout tvp->tv_sec has a value of 5, which is the
DEFAULT_TIMEOUT in ares. ares_timeout choses the smallest
timeout value.

Next day I will try to find a usefull solution for this bug.

D
Received on 2004-03-31