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: Strange very long time in curl_multi_cleanup() after an SSL request

From: Daniel Stenberg via curl-library <>
Date: Sat, 11 Nov 2023 21:21:40 +0100 (CET)

On Thu, 9 Nov 2023, Frédéric BOITEUX via curl-library wrote:

> I'm using libcurl in a C program to perform various web operations. I'm
> using the 'multi' interface to be able to run multiple concurrent requests,
> in an asynchronous manner. I'm working on Linux Debian systems, and I
> recently tried to migrate my program from a Debian 11 to Debian 12 version,
> with libcurl updated from 7.74 to 7.88 version. With this 'new' version,
> I've experienced an unexpected behaviour: sometimes, when closing my app
> [and libcurl], the call to curl_multi_cleanup() takes a [very] long time,
> more than 5 minutes !! After some tests, I could reproduce it doing an
> HTTPS request, then terminating.

You did not say which TLS backend you are using.

> I tried to revert it and test the modified version, and my problem
> disappears :-)

What puzzles me about this is that the change in question is mostly just
reading data, if there is anything to read, but the read should not block.
Obviously, in your case, that is not true.

Can you verify that the extra read is what actually blocks? You can probably
just add printf() or infof() around the read to make that visible in logging.

I figure the next step then depends on the answers on the two questions above.

  | Commercial curl support up to 24x7 is available!
  | Private help, bug fixes, support, ports, new features

Received on 2023-11-11