New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unexpected timeouts #3305

frikiluser opened this Issue Nov 24, 2018 · 0 comments


None yet
2 participants
Copy link

frikiluser commented Nov 24, 2018


I did this

I have a simple URL that takes some time before reply.
For example: "" will took 5.3 seconds.

echo "OK";

I also have a small program based on (
Basically I've changed the URL and added timeout control:
curl_easy_setopt(curl, CURLOPT_TIMEOUT, 6L);
Or (tested both with same results):
curl_easy_setopt(curl, CURLOPT_TIMEOUT_MS, 6*1000);

When I run the program it raises a timeout error after 6 seconds of execution.
curl_easy_perform() failed: Timeout was reached

I expected the following

Timeout should not be raised when the client receives the response before the specified timeout option.

curl/libcurl version

After some work, I've found the problem starts with this commit, merged before 7.61.0:

operating system

Linux 4.18.0-2-amd64 (Debian based)

bagder added a commit that referenced this issue Nov 24, 2018

curl_easy_perform: fix timeout handling
curl_multi_wait() was erroneously used from within
curl_easy_perform(). It could lead to it believing there was no socket
to wait for and then instead sleep for a while instead of monitoring the
socket and then miss acting on that activity as swiftly as it should
(causing an up to 1000 ms delay).

Reported-by: Antoni Villalonga
Fixes #3305
Clodes #3306

@bagder bagder added the libcurl API label Nov 25, 2018

@bagder bagder closed this in 34fe0e1 Nov 25, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment