Buy commercial curl support. We
help you work out your issues, debug your libcurl applications, use the API,
port to new platforms, add new features and more. With a team lead by the
curl founder Daniel himself.
Re: ipv6 connect timeout
- Contemporary messages sorted: [ by date ] [ by thread ] [ by subject ] [ by author ] [ by messages with attachments ]
From: Henrik Holst via curl-library <curl-library_at_lists.haxx.se>
Date: Wed, 27 Aug 2025 16:33:05 +0200
is the request done from outside the vm (so port 8010 is forwarded by the
VM to the Windows machine) or is it done locally on the Windows machine?
/HH
Den ons 27 aug. 2025 kl 15:51 skrev Lars Sunde via curl-library <
curl-library_at_lists.haxx.se>:
> 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 <stefan_at_eissing.org>
> *Sendt:* onsdag 27. august 2025 10:20
> *Til:* libcurl development <curl-library_at_lists.haxx.se>
> *Kopi:* Stenberg Daniel <daniel_at_haxx.se>; Lars Sunde <laasunde_at_hotmail.com
> >
> *Emne:* Re: ipv6 connect timeout
>
>
>
> > Am 27.08.2025 um 10:03 schrieb Lars Sunde via curl-library <
> curl-library_at_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 <daniel_at_haxx.se>
> > Sendt: fredag 22. august 2025 16:57
> > Til: Lars Sunde via curl-library <curl-library_at_lists.haxx.se>
> > Kopi: Lars Sunde <laasunde_at_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
>
Date: Wed, 27 Aug 2025 16:33:05 +0200
is the request done from outside the vm (so port 8010 is forwarded by the
VM to the Windows machine) or is it done locally on the Windows machine?
/HH
Den ons 27 aug. 2025 kl 15:51 skrev Lars Sunde via curl-library <
curl-library_at_lists.haxx.se>:
> 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 <stefan_at_eissing.org>
> *Sendt:* onsdag 27. august 2025 10:20
> *Til:* libcurl development <curl-library_at_lists.haxx.se>
> *Kopi:* Stenberg Daniel <daniel_at_haxx.se>; Lars Sunde <laasunde_at_hotmail.com
> >
> *Emne:* Re: ipv6 connect timeout
>
>
>
> > Am 27.08.2025 um 10:03 schrieb Lars Sunde via curl-library <
> curl-library_at_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 <daniel_at_haxx.se>
> > Sendt: fredag 22. august 2025 16:57
> > Til: Lars Sunde via curl-library <curl-library_at_lists.haxx.se>
> > Kopi: Lars Sunde <laasunde_at_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
>
-- Unsubscribe: https://lists.haxx.se/mailman/listinfo/curl-library Etiquette: https://curl.se/mail/etiquette.htmlReceived on 2025-08-27