On Thu, 24 Jun 2021, Tanner, Matt via curl-library wrote:

We have a multi-threaded embedded linux application that uses curl 7.76.1 for https client requests with easy handles and the multi threaded resolver (AsynchDNS feature). We're seeing intermittent hangs in curl during application shut-down. Its in the resolver. I was wondering if any obvious mis-uses of the library jumped out for anyone, or known bugs.

This is a known bug or issue (https://curl.se/docs/knownbugs.html#Multi_perform_hangs_waiting_for). It is complicated. Once discussed somewhat over here:

 https://github.com/curl/curl/issues/2975

The problem is that one of the name resolving threads is slow and curl awaits them all to die before it can continue, to avoid risking to leak memory. In earlier curl history, it instead leaked memory for that situation but then it didn't do this "hang".

In many cases, the leaked memory might not be a problem and would instead rather be the preferred behavior if the choice existed...

There are legacy areas of our app that do not use curl and are calling getaddrinfo directly in other threads. Could that be a problem?

I don't think that's related.

Its possible we could try the c-ares backend, but I need to try and get a feel for the root cause before starting the process of adding another third-party library.

The c-ares backend does not have this problem as a slow resolve done by c-ares can be cancelled at once.

--

 / daniel.haxx.se
 | Commercial curl support up to 24x7 is available!
 | 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.se/mail/etiquette.html

Reply via email to