cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: cURL sometimes crashes under MS Windows after DNS problems

From: Daniel Stenberg <daniel-curl_at_haxx.se>
Date: Wed, 11 Aug 2004 11:19:51 +0200 (CEST)

On Wed, 11 Aug 2004, Andreas Rieke wrote:

> my application usually works fine with cURL. However, due to some network
> problems, name resolution does not always work, and thus, curl_easy_perform
> sometimes (quite seldom, maybe once a day when using it each 5 minutes)
> returns an error "Couldn't resolve host 'test.arp-guard.com'". When this
> happens, cURL does not call it's write function, but this is certainly ok.
> So far, so good. Each time after this happens, cURL crashes within the next
> call to curl_easy_perform.

Can you figure out more exactly where the crash happens, and then possibly
what the contents of some interesting local variables were at the time of the
crash?

Does it _always_ crash on the next call if the previous one failed like you
describe here?

> Did anyone see similar problems?

We have seen other reports on problems with the win32 version, yes.

> Any ideas how to debug this issue?

It would be interesting to see if building libcurl with c-ares for name
resolving still makes the error happen. Or even try disabling the threaded
resolver. See below for a deeper dig in the libcurl resolver area.

> I have just seen that 7.12.1 is available since yesterday, does it make
> sense to try that one?

It makes sense, yes indeed, but I wouldn't bet any money on it.

> P.S.: I use cURL on linux and windows operating systems, but I have not yet
> seen this problem under linux. However, our linux machines have configured
> at least two nameservers, whereas the MS systems usually have only one
> nameserver configured.

(I'm doing the longer version of my answer here just to provide some general
info about these parts.)

libcurl includes a number of different name resolve functions. They differ
substantially between "Linux" and "Windows":

  1. We have the plain non-ipv6 resolver that can use one out of four host
     name resolve calls:

     A - gethostbyname()
     B - gethostbyname_r() with 3 arguments
     C - gethostbyname_r() with 5 arguments
     D - gethostbyname_r() with 6 arguments

  2. We have the plain ipv6-resolver that uses getaddrinfo()

  3. We have the c-ares based name resolver that uses the c-ares library for
     resolves.

  4. We have the Windows threaded resolver. It uses:

     A - gethostbyname() on plain ipv4 windows hosts
     B - getaddrinfo() on ipv6-enabled windows hosts

On your Linux host, you're most likely using version 1D or 2.

Your Windows host is most likely using 4A. You can make it use 1A or 3 by
choice (I mean without ipv6 support, as if you have that you could do 2 and 4B
as well).

-- 
      Daniel Stenberg -- http://curl.haxx.se -- http://daniel.haxx.se
       Dedicated custom curl help for hire: http://haxx.se/curl.html
Received on 2004-08-11