Menu

#1053 Resolution name hangs longer than specified timeout

closed-works-for-me
5
2013-06-21
2011-09-28
No

Hello world,

I am experiencing a problem with the name resolution, either with c-ares enabled or not. In both cases, if the resolution is not possible (for example by setting a wrong DNS in /etc/resolv.conf or by removing the ethernet cable), libcurl hangs for several seconds before returning, although a timeout is set to 1 second.

Precision: As I am working on UNIX system, I've set the CURLOPT_NOSIGNAL option as recommended, thus avoiding a segfault.

Here is what I observe:
1. c-ares enabled + curl_easy_perform: OK (timeout of 1 second)
2. c-ares enabled + curl_multi_perform: hangs during almost 60 seconds (callback ares_query_completed_cb is not called during this time)
3. c-ares disabled + curl_easy_perform: hangs during 20 seconds (blocked by getaddrinfo in Curl_getaddrinfo_ex)
4. c-ares disabled +curl_multi_perform: hangs during 20 seconds (blocked by getaddrinfo in Curl_getaddrinfo_ex)

Source code is attached (based on mutli-single.c example sample code from curl.haxx.se), as is config.log file (generated at libcurl's build).

Any idea, suggestion or help will be very much appreciated :) Thanks in advance.

Best Regards.
Philippe.

Discussion

  • Philippe Demange

    Source code

     
  • Philippe Demange

    As I could not upload the config.log, here is the configure line:

    ./configure --prefix=/usr --host=sh4-stlinux23-linux-gnu --mandir=/usr/share/man --infodir=/usr/share/info --datadir=/usr/share --sysconfdir=/etc --localstatedir=/var/lib --disable-ldap --disable-ldaps --without-libidn --without-gssapi --without-libssh2 --disable-ipv6 --disable-ares --enable-http --enable-ftp --enable-gopher --enable-file --enable-dict --enable-manual --enable-telnet --enable-smtp --enable-pop3 --enable-imap --enable-rtsp --enable-nonblocking --enable-largefile --enable-maintainer-mode --disable-sspi --without-krb4 --without-spnego --without-gnutls --without-nss --without-ssl --with-random=/dev/urandom

     
  • Daniel Stenberg

    Daniel Stenberg - 2011-09-28

    What libcurl and c-ares version? Can you please provide source code for a little example that can repeat the problem?

     
  • Philippe Demange

    * The already attached file multi-single2.c contains the source code as an example.

    * I used the tag Curl-7_21_0 from official repo:
    # ./src/curl -V
    curl 7.21.0-DEV (x86_64-unknown-linux-gnu) libcurl/7.21.0-DEV zlib/1.2.3.4
    Protocols: dict file ftp http imap pop3 rtsp smtp telnet tftp
    Features: Largefile libz

    I am going to test with the latest version also.

    * libc-ares is 1.7.3-1 (debian testing official package), its soname is libcares.so.2.0.0

     
  • Daniel Stenberg

    Daniel Stenberg - 2011-09-29
    • status: open --> closed-works-for-me
     
  • Daniel Stenberg

    Daniel Stenberg - 2011-09-29

    Before 7.21.2 the lack of timeout support in the multi interface was mentioned in the KNOWN_BUGS. 7.21.2 introduced that support basically.

    In 7.21.3 we bugfixed multi interface timeouts. I believe there have been some additional timeout fixes but I can't quite recall their impact.

    If you need more specific details, I recommend you bisect or just read git logs of history. As this isn't a bug anymore I'm going to close this report. Thanks anyway for reporting!