Skip to content
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

Closed
frikiluser opened this issue Nov 24, 2018 · 0 comments
Closed

Unexpected timeouts #3305

frikiluser opened this issue Nov 24, 2018 · 0 comments

Comments

@frikiluser
Copy link

Hi,

I did this

I have a simple URL that takes some time before reply.
For example: "http://127.0.0.1/sleep.php?sleep=5.3" will took 5.3 seconds.

<?php
usleep($_GET['sleep']*1000*1000):
echo "OK";

I also have a small program based on (https://curl.haxx.se/libcurl/c/simple.html).
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:
3ef67c6

operating system

Linux 4.18.0-2-amd64 (Debian based)

bagder added a commit that referenced this issue Nov 24, 2018
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 closed this as completed in 34fe0e1 Nov 25, 2018
@lock lock bot locked as resolved and limited conversation to collaborators Feb 23, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

No branches or pull requests

2 participants