curl / Mailing Lists / curl-library / Single Mail
Buy commercial curl support from WolfSSL. We help you work out your issues, debug your libcurl applications, use the API, port to new platforms, add new features and more. With a team lead by the curl founder himself.

Re: Curl timeout option in milliseconds

From: karthikeyan Sivakkumar via curl-library <curl-library_at_cool.haxx.se>
Date: Fri, 15 Nov 2019 19:05:55 +0530

Hi Daniel,

Please find the below logs from our application testing.

Cases 1, 2 and 3 work fine but timeout occurs wrongly in cases 4 and 5.

Please correct me if my understanding here is wrong.

*Note : *Time is printed in our logs in UTC time and in T date time format
– YYYY-MM-DDTHH:MM:SS.ssssss

Case 1

CURLOPT_TIMEOUT_MS = 1000 milliseconds

Setting CURLOPT_TIMEOUT_MS to 1000 milliseconds

2019-11-15T07:18:14.267236+5:30|5|xpssapfisblrd06|mqtpreauthsv|44106810|RSKMQT|httpreq.c:133|sendHttpsReq()|
HTTP header: cache-control:no-cache

2019-11-15T07:18:14.267265+5:30|5|xpssapfisblrd06|mqtpreauthsv|44106810|RSKMQT|httpreq.c:133|sendHttpsReq()|
HTTP header: content-type:application/json

2019-11-15T07:18:14.267295+5:30|5|xpssapfisblrd06|mqtpreauthsv|44106810|RSKMQT|httpreq.c:133|sendHttpsReq()|
HTTP header: postman-token:1213

2019-11-15T07:18:14.267326+5:30|5|xpssapfisblrd06|mqtpreauthsv|44106810|RSKMQT|httpreq.c:164|sendHttpsReq()|
CURLOPT_TIMEOUT_MS set to : 1000 milliseconds

2019-11-15T07:18:14.267356+5:30|5|xpssapfisblrd06|mqtpreauthsv|44106810|RSKMQT|httpreq.c:166|sendHttpsReq()|
   CURLOPT_CONNECTTIMEOUT_MS
set to : 1000 milliseconds

2019-11-15T07:18:14.267403+5:30|5|xpssapfisblrd06|mqtpreauthsv|44106810|RSKMQT|httpreq.c:176|sendHttpsReq()|
libssh_version: [], version: [7.66.0],host: [powerpc-ibm-aix7.1.5.0],
features: [2671133], ssl_version: [OpenSSL/1.0.1m], libz_version: [1.2.8]

2019-11-15T07:18:14.267
437+5:30|5|xpssapfisblrd06|mqtpreauthsv|44106810|RSKMQT|fiscurlfunc.c:554|fiscurl_send()|
       Entering
fiscurl_send

************************* Start of cURL library output
*************************

************************* End of cURL library output
*************************

2019-11-15T07:18:15.267
068+5:30|5|xpssapfisblrd06|mqtpreauthsv|44106810|RSKMQT|fiscurlfunc.c:605|fiscurl_send()|
       Transmission
failed!

2019-11-15T07:18:15.267105
+5:30|5|xpssapfisblrd06|mqtpreauthsv|44106810|RSKMQT|httpreq.c:233|sendHttpsReq()|
   fiscurl_send
ret: 28

2019-11-15T07:18:15.267138+5:30|5|xpssapfisblrd06|mqtpreauthsv|44106810|RSKMQT|httpreq.c:240|sendHttpsReq()|
Timeout during http call

2019-11-15T07:18:15.267171+5:30|5|xpssapfisblrd06|mqtpreauthsv|44106810|RSKMQT|httpreq.c:287|sendHttpsReq()|
HTTP Response Code: (0) :: Message : ret: 28

2019-11-15T07:18:15.267232+5:30|5|xpssapfisblrd06|mqtpreauthsv|44106810|RSKMQT|fiscurlfunc.c:83|fiscurl_uninit()|
Entering fiscurl_uninit

Case 2

CURLOPT_TIMEOUT_MS > 1000 milliseconds

*Example 1 – with timeout 1019 milliseconds*

2019-11-15T06:32:35.108536+5:30|5|xpssapfisblrd06|mqtpreauthsv|33030530|RSKMQT|httpreq.c:130|sendHttpsReq()|
HTTP header: cache-control:no-cache

2019-11-15T06:32:35.108570+5:30|5|xpssapfisblrd06|mqtpreauthsv|33030530|RSKMQT|httpreq.c:133|sendHttpsReq()|
HTTP header: cache-control:no-cache

2019-11-15T06:32:35.108606+5:30|5|xpssapfisblrd06|mqtpreauthsv|33030530|RSKMQT|httpreq.c:133|sendHttpsReq()|
HTTP header: content-type:application/json

2019-11-15T06:32:35.108641+5:30|5|xpssapfisblrd06|mqtpreauthsv|33030530|RSKMQT|httpreq.c:133|sendHttpsReq()|
HTTP header: postman-token:1213

2019-11-15T06:32:35.108676+5:30|5|xpssapfisblrd06|mqtpreauthsv|33030530|RSKMQT|httpreq.c:164|sendHttpsReq()|
   CURLOPT_TIMEOUT_MS
set to : 1019 milliseconds

2019-11-15T06:32:35.108711+5:30|5|xpssapfisblrd06|mqtpreauthsv|33030530|RSKMQT|httpreq.c:166|sendHttpsReq()|
CURLOPT_CONNECTTIMEOUT_MS set to : 1019 milliseconds

2019-11-15T06:32:35.108762+5:30|5|xpssapfisblrd06|mqtpreauthsv|33030530|RSKMQT|httpreq.c:176|sendHttpsReq()|
libssh_version: [], version: [7.66.0],host: [powerpc-ibm

-aix7.1.5.0], features: [2671133], ssl_version: [OpenSSL/1.0.1m],
libz_version: [1.2.8]

2019-11-15T06:32:35.108800+5:30|5|xpssapfisblrd06|mqtpreauthsv|33030530|RSKMQT|fiscurlfunc.c:554|fiscurl_send()|
Entering fiscurl_send

************************* Start of cURL library output
*************************

************************* End of cURL library output
*************************

2019-11-15T06:32:36.134513
+5:30|5|xpssapfisblrd06|mqtpreauthsv|33030530|RSKMQT|fiscurlfunc.c:605|fiscurl_send()|
       Transmission
failed!

2019-11-15T06:32:36.134562+5:30|5|xpssapfisblrd06|mqtpreauthsv|33030530|RSKMQT|httpreq.c:233|sendHttpsReq()|
   fiscurl_send
ret: 28

2019-11-15T06:32:36.134593+5:30|5|xpssapfisblrd06|mqtpreauthsv|33030530|RSKMQT|httpreq.c:240|sendHttpsReq()|
Timeout during http call

2019-11-15T06:32:36.134623+5:30|5|xpssapfisblrd06|mqtpreauthsv|33030530|RSKMQT|httpreq.c:287|sendHttpsReq()|
HTTP Response Code: (0) :: Message : ret: 28

2019-11-15T06:32:36.134683+5:30|5|xpssapfisblrd06|mqtpreauthsv|33030530|RSKMQT|fiscurlfunc.c:83|fiscurl_uninit()|
Entering fiscurl_uninit

Case 3

CURLOPT_TIMEOUT_MS > 1000 milliseconds

*Example 2 – with timeout 1111 milliseconds*

2019-11-15T06:34:40.330377+5:30|5|xpssapfisblrd06|mqtpreauthsv|33030534|RSKMQT|httpreq.c:133|sendHttpsReq()|
HTTP header: content-type:application/json

2019-11-15T06:34:40.330411+5:30|5|xpssapfisblrd06|mqtpreauthsv|33030534|RSKMQT|httpreq.c:133|sendHttpsReq()|
HTTP header: postman-token:1213

2019-11-15T06:34:40.330445+5:30|5|xpssapfisblrd06|mqtpreauthsv|33030534|RSKMQT|httpreq.c:164|sendHttpsReq()|
CURLOPT_TIMEOUT_MS set to : 1111 milliseconds

2019-11-15T06:34:40.330478+5:30|5|xpssapfisblrd06|mqtpreauthsv|33030534|RSKMQT|httpreq.c:166|sendHttpsReq()|
CURLOPT_CONNECTTIMEOUT_MS set to : 1111 milliseconds

2019-11-15T06:34:40.330528+5:30|5|xpssapfisblrd06|mqtpreauthsv|33030534|RSKMQT|httpreq.c:176|sendHttpsReq()|
libssh_version: [], version: [7.66.0],host: [powerpc-ibm-aix7.1.5.0],
features: [2671133], ssl_version: [OpenSSL/1.0.1m], libz_version: [1.2.8]

2019-11-15T06:34:40.330565+5:30|5|xpssapfisblrd06|mqtpreauthsv|33030534|RSKMQT|fiscurlfunc.c:554|fiscurl_send()|
Entering fiscurl_send

************************* Start of cURL library output
*************************

************************* End of cURL library output
*************************

2019-11-15T06:34:41.442666+5:30|5|xpssapfisblrd06|mqtpreauthsv|33030534|RSKMQT|fiscurlfunc.c:605|fiscurl_send()|
Transmission failed!

2019-11-15T06:34:41.442719+5:30|5|xpssapfisblrd06|mqtpreauthsv|33030534|RSKMQT|httpreq.c:233|sendHttpsReq()|
fiscurl_send ret: 28

2019-11-15T06:34:41.442757+5:30|5|xpssapfisblrd06|mqtpreauthsv|33030534|RSKMQT|httpreq.c:240|sendHttpsReq()|
Timeout during http call

2019-11-15T06:34:41.442792+5:30|5|xpssapfisblrd06|mqtpreauthsv|33030534|RSKMQT|httpreq.c:287|sendHttpsReq()|
HTTP Response Code: (0) :: Message : ret: 28

Case 4

CURLOPT_TIMEOUT_MS < 1000 milliseconds

*Example 1 – with timeout 900 milliseconds*

2019-11-15T06:30:25.016025+5:30|5|xpssapfisblrd06|mqtpreauthsv|33030528|RSKMQT|httpreq.c:130|sendHttpsReq()|
HTTP header: cache-control:no-cache

2019-11-15T06:30:25.016058+5:30|5|xpssapfisblrd06|mqtpreauthsv|33030528|RSKMQT|httpreq.c:133|sendHttpsReq()|
HTTP header: cache-control:no-cache

2019-11-15T06:30:25.016091+5:30|5|xpssapfisblrd06|mqtpreauthsv|33030528|RSKMQT|httpreq.c:133|sendHttpsReq()|
HTTP header: content-type:application/json

2019-11-15T06:30:25.016124+5:30|5|xpssapfisblrd06|mqtpreauthsv|33030528|RSKMQT|httpreq.c:133|sendHttpsReq()|
HTTP header: postman-token:1213

2019-11-15T06:30:25.016157+5:30|5|xpssapfisblrd06|mqtpreauthsv|33030528|RSKMQT|httpreq.c:164|sendHttpsReq()|
   CURLOPT_TIMEOUT_MS
set to : 900 milliseconds

2019-11-15T06:30:25.016188+5:30|5|xpssapfisblrd06|mqtpreauthsv|33030528|RSKMQT|httpreq.c:166|sendHttpsReq()|
CURLOPT_CONNECTTIMEOUT_MS set to : 900 milliseconds

2019-11-15T06:30:25.016236+5:30|5|xpssapfisblrd06|mqtpreauthsv|33030528|RSKMQT|httpreq.c:176|sendHttpsReq()|
libssh_version: [], version: [7.66.0],host: [powerpc-ibm-aix7.1.5.0],
features: [2671133], ssl_version: [OpenSSL/1.0.1m], libz_version: [1.2.8]

2019-11-15T06:30:25.016275+5:30|5|xpssapfisblrd06|mqtpreauthsv|33030528|RSKMQT|fiscurlfunc.c:554|fiscurl_send()|
Entering fiscurl_send

************************* Start of cURL library output
*************************

************************* End of cURL library output
*************************

2019-11-15T06:30:25.016589+5:30|5|xpssapfisblrd06|mqtpreauthsv|33030528|RSKMQT|fiscurlfunc.c:605|fiscurl_send()|
Transmission failed!

2019-11-15T06:30:25.016621+5:30|5|xpssapfisblrd06|mqtpreauthsv|33030528|RSKMQT|httpreq.c:233|sendHttpsReq()|
fiscurl_send ret: 28

2019-11-15T06:30:25.016653+5:30|5|xpssapfisblrd06|mqtpreauthsv|33030528|RSKMQT|httpreq.c:240|sendHttpsReq()|
Timeout during http call

Case 5

CURLOPT_TIMEOUT_MS < 1000 milliseconds

*Example 1 – with timeout 111 milliseconds*

2019-11-15T06:43:11.369955+5:30|5|xpssapfisblrd06|mqtpreauthsv|65208824|RSKMQT|httpreq.c:133|sendHttpsReq()|
HTTP header: cache-control:no-cache

2019-11-15T06:43:11.369988+5:30|5|xpssapfisblrd06|mqtpreauthsv|65208824|RSKMQT|httpreq.c:133|sendHttpsReq()|
HTTP header: content-type:application/json

2019-11-15T06:43:11.370023+5:30|5|xpssapfisblrd06|mqtpreauthsv|65208824|RSKMQT|httpreq.c:133|sendHttpsReq()|
HTTP header: postman-token:1213

2019-11-15T06:43:11.370060+5:30|5|xpssapfisblrd06|mqtpreauthsv|65208824|RSKMQT|httpreq.c:164|sendHttpsReq()|
CURLOPT_TIMEOUT_MS set to : 111 milliseconds

2019-11-15T06:43:11.370096+5:30|5|xpssapfisblrd06|mqtpreauthsv|65208824|RSKMQT|httpreq.c:166|sendHttpsReq()|
CURLOPT_CONNECTTIMEOUT_MS set to : 111 milliseconds

2019-11-15T06:43:11.370147+5:30|5|xpssapfisblrd06|mqtpreauthsv|65208824|RSKMQT|httpreq.c:176|sendHttpsReq()|
libssh_version: [], version: [7.66.0],host: [powerpc-ibm-aix7.1.5.0],
features: [2671133], ssl_version: [OpenSSL/1.0.1m], libz_version: [1.2.8]

2019-11-15T06:43:11.370187+5:30|5|xpssapfisblrd06|mqtpreauthsv|65208824|RSKMQT|fiscurlfunc.c:554|fiscurl_send()|
Entering fiscurl_send

************************* Start of cURL library output
*************************

************************* End of cURL library output
*************************

2019-11-15T06:43:11.370518+5:30|5|xpssapfisblrd06|mqtpreauthsv|65208824|RSKMQT|fiscurlfunc.c:605|fiscurl_send()|
Transmission failed!

2019-11-15T06:43:11.370555+5:30|5|xpssapfisblrd06|mqtpreauthsv|65208824|RSKMQT|httpreq.c:233|sendHttpsReq()|
fiscurl_send ret: 28

2019-11-15T06:43:11.370590+5:30|5|xpssapfisblrd06|mqtpreauthsv|65208824|RSKMQT|httpreq.c:240|sendHttpsReq()|
Timeout during http call

*Thanks,*

*Karthikeyan T S*

*Programmer Analyst II*

On Fri, 15 Nov 2019, 01:26 Daniel Stenberg, <daniel_at_haxx.se> wrote:

> On Thu, 14 Nov 2019, karthikeyan Sivakkumar wrote:
>
> > 1. Setting the CURLOPT_TIMEOUT_MS to 1001... The timeout happens exactly
> > after 1001 milliseconds.
>
> That doesn't match what I see:
>
> $ time curl -m 0.200 https://daniel.haxx.se/test/slow.cgi
> curl: (28) Resolving timed out after 200 milliseconds
>
> real 0m0.207s
> user 0m0.009s
> sys 0m0.000s
>
> --
>
> / daniel.haxx.se | Get the best commercial curl support there is - from
> me
> | Private help, bug fixes, support, ports, new features
> | https://www.wolfssl.com/contact/
>

-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette: https://curl.haxx.se/mail/etiquette.html
Received on 2019-11-15