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: Name resolution timeout not respected, Curl_resolver_kill() hangs.

From: Woody via curl-library <curl-library_at_lists.haxx.se>
Date: Tue, 16 Nov 2021 09:54:43 +0100

Daniel Stenberg <daniel_at_haxx.se> wrote:
> > I debugged into the curl-library and I discovered that when
> > multi_handle_timeout() detects a timeout, it calls the Curl_resolver_kill().
> >
> > The Curl_resolver_kill() awaits then 11 seconds for Curl_thread_join().
>
> ... I think we should consider providing a way for libcurl to *not* wait for that final thread and continue anyway and that way avoid this "hang" - even if that then also risks causing a memory leak.

I did a test in this direction.

I set data->result in multi_handle_timeout() and then in case of non-zero in
Curl_resolver_kill() I simple avoided calling the Curl_thread_join().

--------------------------------------------
...
/* wait for the thread to resolve the name if no error already occurred */
if (data->result == CURLE_OK) {
  if (Curl_thread_join(&td->thread_hnd))
  {
    if (entry)
      result = getaddrinfo_complete(data);
  }
...
--------------------------------------------

It was just a test and it worked, but obviously it raises more doubts than
those it solves... :-)

--
Best regards.
Woody from WiBu Systems AG.
-- 
Unsubscribe: https://lists.haxx.se/listinfo/curl-library
Etiquette:   https://curl.haxx.se/mail/etiquette.html
Received on 2021-11-16