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
Operation timed out after 0 milliseconds with 0 out of 0 bytes received #619
Comments
Though this report seems to have some merit for the incorrect timeout message please note this is an issue tracker and in any other case your questions should be directed to the curl-library mailing list where you will get a wider audience. I can confirm sometimes the connect timeouts may show as incorrect and show an error message of
Can you give us your Regarding the rest of what you wrote: You should use exactly the types specified, for example most values must be When curl uses OpenSSL for its backend if there's session re-use you should see an abbreviated handshake. I don't know why the Client hello isn't sent. You may want to check in Wireshark to see if it actually is being sent. I tried session re-use on that server and it appears to work fine (using libcurl/7.47.0-DEV OpenSSL/1.0.2e).
|
Thanks for the response. Indeed the main reason for reporting this is the incorrect error message. curl -V gives this: Timeout is indeed set to 20s. I changed it to 20L now. Content length is set to 0 for some files that represent manifest objects in swift storage, but the issue does not occur only for 0 lenght files, as I mention I also get the error while performing GET requests. |
Any news? We can't reproduce this problem based on this little data. |
I was not able yet to reproduce, I think the issue appears when the target
|
As its not reproducible and we have no clues on where to start looking for a problem that hit once, I close this. If we get more/new details we can always re-open or create a new bug then. |
I didn't have time to explore this further, here is more detail in case you have any ideas. I haven't reproduced his specific use case because I would need more information on that. However I can reproduce that error message. I had some problem debugging because any wait affects the path so when I break at almost any point it messes up the reproduction. The way I can reproduce is if https and a ClientHello is sent but no ServerHello is received and a connect timeout is set. But I don't see that same thing in the reporter's output. To reproduce listen on a port using netcat or socat but don't use a ssl/tls layer, like
Sometimes it doesn't show that error message, and will instead just say A possible fix for the 0ms might be change k->now in this line in multi to just the actual now time. diff --git a/lib/multi.c b/lib/multi.c
index 069412d..26a965f 100644
--- a/lib/multi.c
+++ b/lib/multi.c
@@ -1070,7 +1070,7 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi,
failf(data, "Operation timed out after %ld milliseconds with %"
CURL_FORMAT_CURL_OFF_T " out of %"
CURL_FORMAT_CURL_OFF_T " bytes received",
- Curl_tvdiff(k->now, data->progress.t_startsingle),
+ Curl_tvdiff(Curl_tvnow(), data->progress.t_startsingle),
k->bytecount, k->size);
}
else {
Unless there's something wrong with k->now, maybe it's supposed to be updated and wasn't. I didn't have more time to look into that. |
I took another look at this and Sometimes there is a few milliseconds of difference between the initial Curl_pgrsTime(data, TIMER_STARTSINGLE); <-- data->progress.t_startsingle set here
result = Curl_connect(data, &data->easy_conn,
&async, &protocol_connect); <-- data->req.now set here (create_conn calls Curl_init_do which sets it) So when we get the difference between We could either update diff --git a/lib/multi.c b/lib/multi.c
index 069412d..3d0c4b9 100644
--- a/lib/multi.c
+++ b/lib/multi.c
@@ -1064,6 +1064,9 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi,
else if(data->mstate == CURLM_STATE_WAITCONNECT)
failf(data, "Connection timed out after %ld milliseconds",
Curl_tvdiff(now, data->progress.t_startsingle));
+ else if(data->mstate < CURLM_STATE_PERFORM)
+ failf(data, "Connection timed out after %ld milliseconds",
+ Curl_tvdiff(now, data->progress.t_startsingle));
else {
k = &data->req;
if(k->size != -1) { |
I'm suffering the same thing, that error just randomly happens:
|
@hieuvo any information you can give us on when it's happening would be helpful. Can you enable verbose output and let us know what you see before the error occurs? Are the URLs it happens with all of one type? For example, are they all https.. |
yes, they are all https. It happens on our live production servers. |
The curl's results are mixed of:
Although, most of urls and data format are the same |
I'm pretty sure this fixes the reported problem. If you experience it after this fix, please let us know and give us details on how to reproduce. |
Use the local, reasonably updated, 'now' value when creating the message string to output for the timeout condition. Fixes curl#619
For statistics, we experience this (intermittent) issue while accessing Amazon S3 servers. Thanks for fixing the error message, with the information in this ticket, it's clear we're hitting server overload issues. |
I use CURL to perform upload/download operations via HTTP from an openstack Swift server (www.hubic.com).
I get random errors "Operation timed out after 0 milliseconds with 0 out of 0 bytes received" both on HTTP PUT and GET operations. After several retries it will eventually work.
The message seems to be incorrect as the timeout is set to 20 ms.
Can someone confirm if this timeout occurs in the SSL handshake? If yes, are there any other curl flags I can use to increase connection reliability?
The code excerpts and some debug data can be found below.
Code extras
curl_easy_setopt(curl, CURLOPT_URL, url);
curl_easy_setopt(curl, CURLOPT_HEADER, 0);
curl_easy_setopt(curl, CURLOPT_NOSIGNAL, 1);
curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 0);
curl_easy_setopt(curl, CURLOPT_USERAGENT, USER_AGENT);
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 1);
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 1);
curl_easy_setopt(curl, CURLOPT_CONNECTTIMEOUT, 20);
curl_easy_setopt(curl, CURLOPT_VERBOSE, 1);
curl_easy_setopt(curl, CURLOPT_TCP_NODELAY, 1);
curl_easy_setopt(curl, CURLOPT_UPLOAD, 1);
curl_easy_perform(curl);
Debug output
CURL version=7.38.0 ssl=OpenSSL/1.0.1k
[2016-01-27 23:18:37.]:26085==adding extra header: X-Copy-From: /default_fuse_segments/default/test/t2_segments/medium.txt/1453929407.883449/00000003
[2016-01-27 23:18:37.]:26085==adding extra header: Content-Length: 0
CApath: /etc/ssl/certs
The text was updated successfully, but these errors were encountered: