> 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

Reply via email to