This might be a bug report but I wanted to get insight here before I go that route, in case "the problem is me".
I have been having an issue using Composer for a PHP project with 'update' commands complaining of curl encountering a timeout. I tried using curl directly to request the same file and saw the same issue: a delay of >10s during DNS resolution phase. It is almost always about that long although on rare occasions (less than 1/20) it can be almost immediate.
Here it is with debugging cranked up:
Code: Select all
$ curl -vvvv https://packages.drupal.org/8/packages.json
12:48:49.768182 [0-x] * [MULTI] [INIT] added to multi, mid=1, running=1, total=2
12:48:49.768226 [0-x] * [MULTI] [INIT] multi_wait(fds=1, timeout=0) tinternal=0
12:48:49.768288 [0-x] * [MULTI] [INIT] -> [SETUP]
12:48:49.768344 [0-x] * [MULTI] [SETUP] -> [CONNECT]
12:48:49.768378 [0-x] * [READ] client_reset, clear readers
12:48:49.768447 [0-0] * [MULTI] [CONNECT] [CPOOL] added connection 0. The cache now contains 1 members
12:48:49.768613 [0-0] * [DNS] asyn-ares: servers=192.168.2.30:53,192.168.2.1:53
12:48:49.768667 [0-0] * [DNS] asyn-ares: fire off getaddrinfo for A+AAAA
12:48:49.768886 [0-0] * [DNS] asyn-ares: fire off query for HTTPSRR: packages.drupal.org
12:48:49.768975 [0-0] * [MULTI] [CONNECT] -> [RESOLVING]
12:48:49.769031 [0-0] * [TIMER] [ASYNC_NAME] set for 1999000ns
12:48:49.769068 [0-0] * [MULTI] [RESOLVING] multi_wait pollset[fd=4 IN], timeouts=1
12:48:49.769116 [0-0] * [TIMER] [ASYNC_NAME] expires in 1998915ns
12:48:49.769158 [0-0] * [TIMER] [ASYNC_NAME] gives multi timeout in 2000ms
12:48:49.769207 [0-0] * [MULTI] [RESOLVING] multi_wait(fds=2, timeout=1000) tinternal=2000
12:48:49.772218 [0-0] * [DNS] Curl_resolv_check() -> 0, missing
12:48:49.772246 [0-0] * [TIMER] [ASYNC_NAME] set for 1996000ns
12:48:49.772330 [0-0] * [MULTI] [RESOLVING] multi_wait pollset[fd=4 IN], timeouts=1
12:48:49.772380 [0-0] * [TIMER] [ASYNC_NAME] expires in 1995865ns
12:48:49.772420 [0-0] * [TIMER] [ASYNC_NAME] gives multi timeout in 1997ms
12:48:49.772469 [0-0] * [MULTI] [RESOLVING] multi_wait(fds=2, timeout=1000) tinternal=1997
12:48:49.772722 [0-0] * [DNS] Curl_resolv_check() -> 0, missing
12:48:49.772781 [0-0] * [TIMER] [ASYNC_NAME] set for 1996000ns
12:48:49.772819 [0-0] * [MULTI] [RESOLVING] multi_wait pollset[fd=4 IN], timeouts=1
12:48:49.772872 [0-0] * [TIMER] [ASYNC_NAME] expires in 1995908ns
12:48:49.772914 [0-0] * [TIMER] [ASYNC_NAME] gives multi timeout in 1997ms
12:48:49.772964 [0-0] * [MULTI] [RESOLVING] multi_wait(fds=2, timeout=1000) tinternal=1997
12:48:49.784644 [0-0] * [DNS] Curl_resolv_check() -> 0, missing
12:48:49.784671 [0-0] * [TIMER] [ASYNC_NAME] set for 1984000ns
12:48:49.784726 [0-0] * [MULTI] [RESOLVING] multi_wait pollset[fd=4 IN], timeouts=1
12:48:49.784787 [0-0] * [TIMER] [ASYNC_NAME] expires in 1983885ns
12:48:49.784835 [0-0] * [TIMER] [ASYNC_NAME] gives multi timeout in 1985ms
12:48:49.784892 [0-0] * [MULTI] [RESOLVING] multi_wait(fds=2, timeout=1000) tinternal=1985
12:48:50.786100 [0-0] * [DNS] Curl_resolv_check() -> 0, missing
12:48:50.786138 [0-0] * [TIMER] [ASYNC_NAME] set for 982000ns
12:48:50.786215 [0-0] * [MULTI] [RESOLVING] multi_wait pollset[fd=4 IN], timeouts=1
12:48:50.786302 [0-0] * [TIMER] [ASYNC_NAME] expires in 981835ns
12:48:50.786341 [0-0] * [TIMER] [ASYNC_NAME] gives multi timeout in 983ms
12:48:50.786388 [0-0] * [MULTI] [RESOLVING] multi_wait(fds=2, timeout=983) tinternal=983
12:48:51.770573 [0-0] * [DNS] ares: addrinfo done, query status=0, overall status=0, pending=1, addr=found
12:48:51.770721 [0-0] * [DNS] Curl_resolv_check() -> 0, missing
12:48:51.770768 [0-0] * [TIMER] [ASYNC_NAME] set for 1999000ns
12:48:51.770809 [0-0] * [MULTI] [RESOLVING] multi_wait pollset[fd=5 IN, fd=4 IN], timeouts=1
12:48:51.770870 [0-0] * [TIMER] [ASYNC_NAME] expires in 1998897ns
12:48:51.770921 [0-0] * [TIMER] [ASYNC_NAME] gives multi timeout in 2000ms
12:48:51.770984 [0-0] * [MULTI] [RESOLVING] multi_wait(fds=3, timeout=1000) tinternal=2000
12:48:51.771527 [0-0] * [MULTI] [RESOLVING] Curl_multi_will_close fd=4
12:48:51.771595 [0-0] * [DNS] Curl_resolv_check() -> 0, missing
[...SNIP repetitions...]
12:49:12.548488 [0-0] * [TIMER] [ASYNC_NAME] set for 55000ns
12:49:12.548542 [0-0] * [MULTI] [RESOLVING] multi_wait pollset[fd=4 IN], timeouts=1
12:49:12.548587 [0-0] * [TIMER] [ASYNC_NAME] expires in 54901ns
12:49:12.548655 [0-0] * [TIMER] [ASYNC_NAME] gives multi timeout in 55ms
12:49:12.548697 [0-0] * [MULTI] [RESOLVING] multi_wait(fds=2, timeout=55) tinternal=55
12:49:12.603942 [0-0] * [DNS] Curl_resolv_check() -> 0, missing
12:49:12.603970 [0-0] * [TIMER] [ASYNC_NAME] set for 0ns
12:49:12.603997 [0-0] * [MULTI] [RESOLVING] multi_wait pollset[fd=4 IN], timeouts=1
12:49:12.604094 [0-0] * [TIMER] [ASYNC_NAME] expires in -124ns
12:49:12.604158 [0-0] * [TIMER] [ASYNC_NAME] gives multi timeout in 0ms
12:49:12.604204 [0-0] * [MULTI] [RESOLVING] multi_wait(fds=2, timeout=0) tinternal=0
12:49:12.604251 [0-0] * [DNS] ares: httpsrr done, status=12, pending=0, dnsres=not found
12:49:12.604329 [0-0] * [DNS] is_resolved() result=0, dns=found
12:49:12.604367 [0-0] * Host packages.drupal.org:443 was resolved.
12:49:12.604406 [0-0] * IPv6: (none)
12:49:12.604431 [0-0] * IPv4: 146.75.74.217
12:49:12.604480 [0-0] * [DNS] Curl_resolv_check() -> 0, found
192.168.2.30: dnsmasq serving DNS+DHCP for local hosts
192.168.2.1: Fritz!Box router/modem
The dnsmasq server delegates to the router, and the router to my ISP's resolvers. Both are adequately responsive for all other requests, including wget requests for the same URL. Both have the issue, as I confirmed by disabling the dnsmasq box in resolv.conf leaving only the router listed.
I have read that curl attempting IPv6 lookups where IPv6 support on the network is incomplete can be an issue, but doing curl -4 makes no difference.
Both Gentoo machines on this LAN have the same issue, running net-misc/curl-8.17.0-r1. A RasPi on the same network, running curl-8.14, has no problem.
The delay does not occur when forcing curl to use an upstream resolver, e.g. curl --dns-servers 8.8.8.8 or one of my ISP's, so part of the problem seems to be with config/limitations of the local resolvers.
USE flags are as follows.
Code: Select all
[ebuild R ] net-misc/curl-8.17.0-r1::gentoo USE="adns alt-svc ftp hsts http2 http3 httpsrr imap openssl pop3 psl quic samba smtp ssl tftp websockets -brotli -debug -ech -gnutls -gopher -idn -kerberos -ldap -mbedtls -rtmp -rustls -sasl-scram -ssh -static-libs -telnet -test -verify-sig -zstd" ABI_X86="(64) -32 (-x32)" CURL_QUIC="openssl -ngtcp2" CURL_SSL="openssl -gnutls -mbedtls -rustls"


