cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: curl multi pipelining and CURLOPT_CONNECTTIMEOUT

From: Török Edwin <edwin+ml-curl_at_etorok.net>
Date: Tue, 29 Jan 2013 11:47:21 +0200

On 01/29/2013 10:29 AM, Daniel Stenberg wrote:
> On Thu, 24 Jan 2013, Török Edwin wrote:
>
>> I am using the curl multi interface and I see a lot of timeouts on slowish links (all fine on fast links of course). I have concluded that CURLOPT_CONNECTTIMEOUT sets not only the timeout for
>> connect(), but also the timeout for starting to receive a reply for a pipelined request.
>
> If that's so, then it is a bug. You didn't mention what libcurl version you're using.

7.28.0 from Debian. But it reproduces with 7.28.1 too.

See attached testcase:
$ ./curltest
CURL version: libcurl/7.28.1 OpenSSL/1.0.1c zlib/1.2.7
....
* Operation timed out after 5000 milliseconds with 0 out of 0 bytes received
Result: Timeout was reached
* Operation timed out after 5000 milliseconds with 0 out of 0 bytes received
* Operation timed out after 5000 milliseconds with 0 out of 0 bytes received
* Operation timed out after 5000 milliseconds with 0 out of 0 bytes received
* Operation timed out after 5000 milliseconds with 0 out of 0 bytes received
* Operation timed out after 5000 milliseconds with 0 out of 0 bytes received
Result: Timeout was reached
...
OK: 1, Failed: 7

If you remove CURLMOPT_PIPELINING from the testcase it works:
Result: No error
OK: 8, Failed: 0

>
> This said, Linus Nielsen Feltzing has a pretty massive HTTP pipelining patch pending to get merged at some point after the 7.29.0 release so I'm reluctant to fix anything pipeline-related until then.
> Possibly we should ask Linus how to get his latest tree so that we can start trying out your problem on that already now.
>
>> Note: I'm actually interested in persistent connections only, not necesarely pipelining (that is just a nice addition), but in the multi interface I don't see a way to request that only: it is
>> either both (MOPT_PIPELINING on), or neith (MOPT_PIPELINING off, separate connections).
>
> Without pipelining it can't re-use the connections if you do multiple requests in parallel. Without pipelining you need to issue the requests in a serial manner if you want them to re-use connections.

Yes, I think that is what I'll do (add easy handle to multi only when previous finished for the same host).

>
> Again, the pending work from Linus will allow some more customizibility in this area as well.

Looking forward to try that out.

Thanks,
--Edwin

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html

Received on 2013-01-29