You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Failed connect returns CURLE_OPERATION_TIMEOUT instead of CURLE_COULDNT_CONNECT on Windows Server 2016 #23084
After updating from libcurl 8.19.0 to 8.22.0 we experienced the following problem in one of our system tests.
What the test does:
We switch of one of our components during the system test (after having already executed some requests) to check whether or retry-handling works correctly.
Prior to the update we got CURLE_COULDNT_CONNECT when trying to execute a request after shutting down the component on localhost (it's a POST request executed via curl_easy_perform()), after the update we get a CURLE_OPERATION_TIMEOUT.
Also the timeout that actually is used is the operation timeout and not the connection timeout.
We re-tried with libcurl 8.21.0 - this worked the same way like 8.19.0, so the change that introduced this new behaviour seems to be introduced in 8.22.0. The unrealeased master version, that I tried (aff6f93... aff6f93) also behaved the same way as 8.22.0.
When running on Windows Professional 11 this seems not to be the case. There the connection timeout and correct error code is used with libcurl 8.22.0. So this seems to be something specific to some and not all windows environments.
I expected the following
CURLE_COULDNT_CONNECT when a connection cannot be made after the connection timout expired (or sooner) - as with libcurl 8.19.0 - and not CURLE_OPERATION_TIMEOUT after the operation timeout expired.
I notice in your log everything says loclahost and not localhost? Example:
2026-09-24/16:52:42.698 - == Info: [11-0] Issue another request to this URL: 'http://loclahost:8088/my/test/url/path'
When running on Windows Professional 11 this seems not to be the case. There the connection timeout and correct error code is used with libcurl 8.22.0. So this seems to be something specific to some and not all windows environments.
Can you bisect it? how to git bisect. The instructions there are for an autotools build but the bisect process is the same regardless of build method.
changed the title [-]Windows Server 2016: Operation timeout and error (CURLE_OPERATION_TIMEOUT) is used instead of connection timeout and error (CURLE_COULDNT_CONNECT) when making request to shut down component.[/-][+]Failed connect returns CURLE_OPERATION_TIMEOUT instead of CURLE_COULDNT_CONNECT on Windows Server 2016[/+]on Sep 24, 2026
well, I „sanitized“ the URL from the output and the replacement seems to have had a typo in it 😄
I‘m not sure whether I‘ll have the time to do some bisecting tomorrow, but I will try to have a go at it - if not tomorrow then next week.
Looks to me as if Windows did fix a networking bug in its product in the last 10 years, but did not backport it. Or maybe a registry setting is affecting this. Hard to say.
From curl's side, the log show that it opened a socket to localhost 8080 and is waiting for it to become writeable or fail - neither of which happens.
It is quite strange that switching off SYN retries on localhost would have this effect and as mentioned this seems to imply that your outdated Windows version has a bug in there.
One way to address this would be to figure out the cutoff version: which Windows version range has this bug, and avoid setting this option for that range. But I don't know how we would go about and figure that out...
I could test on Windows Server 2025 (as well as on Windows Pro 11, like I said in the ticket description). The effect is not visible there, so Windows Server 2025 is OK.
The issue is that the flag TCP_INITIAL_RTO_NO_SYN_RETRANSMISSIONS, which we passed in to completely eliminate the network delay, isn't defined (or checked) on Windows 10 versions prior to RS3 (Redstone 3). The flag was interpreted as TCP_INITIAL_RTO_DEFAULT_MAX_SYN_RETRANSMISSIONS, causing a retry of 255 times, each one taking 500ms. This made each individual connect delay take 128 seconds in total.
done bisecting. it tells me abcb534 is the first bad commit
Thanks I can confirm in Windows 8. It would be helpful if you could try #23103 in Windows Server 2016. There is an automated build of curl-for-win so you don't need to build the branch. Go to the PR > 'Checks' tab > curl-for-win sidebar > Artifacts pane at the bottom > curl.exe
Please show the error output of curl -v http://localhost:12345
It should be something like this:
curl: (7) Failed to connect to localhost:12345 after 741 ms: Could not connect to server
Activity
icing commentedon Sep 24, 2026
Can you produce a trace of such a run?
DEBUG_FUNCTIONandcurl_global_trace("all")would be good.aschank commentedon Sep 24, 2026
Thanks for the quick response.
I have used a debug_function as proposed in https://curl.se/libcurl/c/CURLOPT_DEBUGFUNCTION.html. I appended the output:
curl-23084_debug_function.zip
Please let me know, if you need additional info.
jay commentedon Sep 24, 2026
I notice in your log everything says loclahost and not localhost? Example:
Can you bisect it? how to git bisect. The instructions there are for an autotools build but the bisect process is the same regardless of build method.
[-]Windows Server 2016: Operation timeout and error (CURLE_OPERATION_TIMEOUT) is used instead of connection timeout and error (CURLE_COULDNT_CONNECT) when making request to shut down component.[/-][+]Failed connect returns CURLE_OPERATION_TIMEOUT instead of CURLE_COULDNT_CONNECT on Windows Server 2016[/+]aschank commentedon Sep 24, 2026
well, I „sanitized“ the URL from the output and the replacement seems to have had a typo in it 😄
I‘m not sure whether I‘ll have the time to do some bisecting tomorrow, but I will try to have a go at it - if not tomorrow then next week.
aschank commentedon Sep 25, 2026
done bisecting. it tells me abcb534 is the first bad commit
icing commentedon Sep 25, 2026
Looks to me as if Windows did fix a networking bug in its product in the last 10 years, but did not backport it. Or maybe a registry setting is affecting this. Hard to say.
From curl's side, the log show that it opened a socket to localhost 8080 and is waiting for it to become writeable or fail - neither of which happens.
bagder commentedon Sep 25, 2026
It is quite strange that switching off SYN retries on localhost would have this effect and as mentioned this seems to imply that your outdated Windows version has a bug in there.
One way to address this would be to figure out the cutoff version: which Windows version range has this bug, and avoid setting this option for that range. But I don't know how we would go about and figure that out...
aschank commentedon Sep 25, 2026
I could test on Windows Server 2025 (as well as on Windows Pro 11, like I said in the ticket description). The effect is not visible there, so Windows Server 2025 is OK.
bagder commentedon Sep 25, 2026
(source)
bagder commentedon Sep 25, 2026
So maybe something like #23103 ?
jay commentedon Sep 25, 2026
Thanks I can confirm in Windows 8. It would be helpful if you could try #23103 in Windows Server 2016. There is an automated build of curl-for-win so you don't need to build the branch. Go to the PR > 'Checks' tab > curl-for-win sidebar > Artifacts pane at the bottom > curl.exe
Please show the error output of
curl -v http://localhost:12345It should be something like this:
aschank commentedon Sep 25, 2026
I can confirm it. On Windows Server 2016:
curl 8.22.0:
The version with the fix:
Thanks for the quick response 👍
cf-socket: adjust NO_SYN_RETRANSMISSIONS for older Windows
cf-socket: adjust NO_SYN_RETRANSMISSIONS for older Windows