Skip to content

CURLOPT_CONNECTTIMEOUT_MS seems to be broken #15100

@denizsokmen

Description

@denizsokmen

I did this

I upgraded from libcurl 8.1.2 to 8.10.1

I use c-ares backend.

I use multi interface and create a transfer with just 2 seconds of connect timeout:

curl_easy_setopt(curl, CURLOPT_CONNECTTIMEOUT_MS, 2000L);

I expected the following

I expect multi to time out my request in 2 seconds during connection/resolving phase. It rather waits for entire CURLOPT_TIMEOUT_MS before timing out.

Seems to have been broken since #13371

Interesting thing is that there is not a single call to multi_handle_timeout() with connect_timeout parameter set to TRUE since that PR. I haven't followed the logic to see whether it's needed or not anymore. But reverting it back to TRUE here in this line fixes the issue: https://github.com/curl/curl/blob/master/lib/multi.c#L2545 :

[verb] STATE: INIT => SETUP handle 0x15120b008; line 1878
[verb] STATE: SETUP => CONNECT handle 0x15120b008; line 1894
[verb] Added connection 11. The cache now contains 9 members
[verb] STATE: CONNECT => RESOLVING handle 0x15120b008; line 1919
[verb] Resolving timed out after 2011 milliseconds
[verb] multi_done[RESOLVING]: status: 28 prem: 1 done: 0
[verb] Curl_multi_closed, fd=15 multi is 0x157a5a7e8
[verb] Curl_multi_closed, fd=15 entry is 0x600000fb42a8
[verb] multi_done, not reusing connection=11, forbid=0, close=0, premature=1, conn_multiplex=0
[verb] Curl_disconnect(conn #11, aborted=1)
[verb] closing connection #11
[verb] [CCACHE] closing #11
[verb] Expire cleared

curl/libcurl version

8.10.1

operating system

macOS

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions