Appreciate your response Stefan. The current setup is running on Windows 10 (inside a VM) that has one Ethernet adapter that is configured with IPv6 and IPv4. Both IPv6 and IPv4 is setup with "Obtain an IPv4/6 address automatically". Using ipconfig I can see that 192.168.56.102 is assigned which is IPv4 and no IPv6 is assigned. I believe this is a default Windows 10 setup, so basically a vanilla Windows setup.
You mention that Curl has an internal timer. * Is this timer used to enforce CURLOPT_CONNECTTIMEOUT and CURLOPT_TIMEOUT time constraints? * Is this timer used enforce CURLOPT_HAPPY_EYEBALLS_TIMEOUT_MS time constraints? We use "http://localhost:8010/some/path" in our test setup. In most test runs we see that curl uses 200-300 ms to check IPv6 and then moving on to IPv4 which is quickly resolved to 127.0.0.1 and used to communicate with server. This is understandable. In some rare cases we see that curl uses 3-10 seconds to check IPv6 which often causes a timeout. I am struggling to understand why in some rare cases "the system" need so long to fail to resolve "localhost" on IPv6. I understand it is possible to force Curl to use IPv4 but do not want to remove IPv6 as an option. Also, If the IPv6 address is unchecked in ethernet adapter it is still used by Curl which seems strange. Regards, Lars ________________________________ Fra: Stefan Eissing <ste...@eissing.org> Sendt: onsdag 27. august 2025 10:20 Til: libcurl development <curl-library@lists.haxx.se> Kopi: Stenberg Daniel <dan...@haxx.se>; Lars Sunde <laasu...@hotmail.com> Emne: Re: ipv6 connect timeout > Am 27.08.2025 um 10:03 schrieb Lars Sunde via curl-library > <curl-library@lists.haxx.se>: > > Thanks for the link to the blog which explain part of the problem. However, > when running libCurl 8.5 in a VM on Windows 10 we sometimes see that "Trying > [::1]:8010..." takes upto 10 seconds to complete which is quite a long time. > We have setup curl with CURLOPT_TIMEOUT to 600 seconds, > CURLOPT_CONNECTTIMEOUT to 10 seconds and CURLOPT_HAPPY_EYEBALLS_TIMEOUT_MS to > 200. Windows 10 has a "Max SYN Retransmissions" parameter which is set to 4 > in our environment but that does not really explain the delay. You can see > this parameter via "netsh interface tcp show global" command. If your CURLOPT_CONNECTTIMEOUT is 10 seconds, then trying an address for up to 10 seconds sounds right. > > How is the CURLOPT_HAPPY_EYEBALLS_TIMEOUT_MS option implemented in curl? Does > it rely on the OS functionality to respond within a timeframe or does it use > an internal timer? Has there been any changes\bug-fixes to happy eyeballs > algorithm between version 8.5 and 8.15? libcurl uses an internal timer. CURLOPT_HAPPY_EYEBALLS_TIMEOUT_MS triggers and, if there are addresses from different ip versions, the other ip version is attempted in parallel (unless you tell curl explicitly to only use on ip version). It, by default, starts with ipv6 when available and CURLOPT_HAPPY_EYEBALLS_TIMEOUT_MS triggers the ipv4 attempts. If your hostname resolves to a single ipv6 address, this will not do anything. No other ip family is available, no other address is available. The single address will be attempted to 10 seconds, unless the OS reports a failure. If the host has several ipv6 addresses, it will attempt each address, one after the other, with timouts depending on time remaining and addresses available. Any new attempt closes the previous one of the same ip family. This is unchanged in curl < 8.16. In 8.16, the strategy to try different addresses in the same ip version changes. Ongoing attempts will not be closed, just new ones added. A hostname with 10 ipv6 addresses might have, during the connect phase, up to 10 sockets open. The CURLOPT_HAPPY_EYEBALLS_TIMEOUT_MS to start attempts on the other ip version remains the same. Hope this helps, Stefan > > Regards, LarsFra: Daniel Stenberg <dan...@haxx.se> > Sendt: fredag 22. august 2025 16:57 > Til: Lars Sunde via curl-library <curl-library@lists.haxx.se> > Kopi: Lars Sunde <laasu...@hotmail.com> > Emne: Re: ipv6 connect timeout On Fri, 22 Aug 2025, Lars Sunde via > curl-library wrote: > > > We are running C++ software that uses libCurl 8.5 on Windows 10 and 11 that > > perform HTTP operations. > > > > During testing I notice a difference in some rare situations when running > > the software in Window 11 and in a virtual machine. The virtual machine is > > Oracle Virtual Box with Windows 11 host and Windows 10 guest OS). > > > > We enabled CURLOPT_VERBOSE to debug the issue when the software attempts to > > perform a HTTP post operation. > > I suspect you are seeing Windows working as designed. I believe this is more > or less the same problem I blogged aobut last year: > > https://daniel.haxx.se/blog/2024/08/14/slow-tcp-connect-on-windows/ > > -- > > / daniel.haxx.se || https://rock-solid.curl.dev > -- > Unsubscribe: https://lists.haxx.se/mailman/listinfo/curl-library > Etiquette: https://curl.se/mail/etiquette.html
-- Unsubscribe: https://lists.haxx.se/mailman/listinfo/curl-library Etiquette: https://curl.se/mail/etiquette.html