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 Sending FINS without curl_multi_cleanup, and ways to avoid it

From: Daniel Stenberg via curl-library <curl-library_at_cool.haxx.se>
Date: Tue, 13 Aug 2019 17:47:13 +0200 (CEST)

On Tue, 13 Aug 2019, Aravindhan Krishnan via curl-library wrote:

> I have enabled pipeline with pipe-length of 5 (default)

I would advice against enabling pipelining. It had several issues and it has
been removed in later versions.

> and have set CURLMOPT_MAX_TOTAL_CONNECTIONS and
> CURLMOPT_MAX_HOST_CONNECTIONS to 5, just in case if it helps for the
> question below.

Limiting the connection cache and number of parallel connections will not help
curl to do more or better persistent connections.
CURLMOPT_MAX_TOTAL_CONNECTIONS will rather risk capping curl into closing
connections more frequently than otherwise and CURLMOPT_MAX_HOST_CONNECTIONS
risks making curl queue up requests that could otherwise get performed
earlier.

> The client is just an extended version of the sample indicated by
> multi-uv.c, where in I send 20 requests, get the responses, process them and
> repeat the process infinitely. During the entire process I don’t call
> curl_multi_cleanup, but after receiving and processing every response, I
> call curl_multi_remove_handle and curl_easy_cleanup for the completed easy
> handle.

You do 20 parallel requests and has asked libcurl to not keep more than 5 in
the connection cache. 5 is less than 20. There's no room to keep any
connection alive after they're done. They will be closed and discarded as soon
as possible. As requested.

I would suggest you start by simply not setting those options and let libcurl
use its defaults there.

> I was under the impression that there will be no FINs going out of the
> client, and clearly I am wrong.

Correct, libcurl will close connections it could otherwise keep alive - unless
of course there's a reason to. Like keeping the number of connections down or
killing off old ones etc.

-- 
  / 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-08-13