asyn-thrdd: drop pthread_cancel

Remove use of pthread_cancel in asnyc threaded resolving. While there
are system where this works, others might leak to resource leakage
(memory, files, etc.). The popular nsswitch is one example where resolve
code can be dragged in that is not prepared.

The overall promise and mechanism of pthread_cancel() is just too
brittle and the historcal design of getaddrinfo() continues to haunt us.

Fixes #18532
Reported-by: Javier Blazquez
Closes #18540
This commit is contained in:
Stefan Eissing 2025-09-13 15:25:53 +02:00 committed by Daniel Stenberg
parent f7cac7cc07
commit de3fc1d7ad
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
10 changed files with 16 additions and 217 deletions

View file

@ -1132,10 +1132,6 @@ CURLcode Curl_resolv_timeout(struct Curl_easy *data,
prev_alarm = alarm(curlx_sltoui(timeout/1000L));
}
#ifdef DEBUGBUILD
Curl_resolve_test_delay();
#endif
#else /* !USE_ALARM_TIMEOUT */
#ifndef CURLRES_ASYNCH
if(timeoutms)
@ -1639,18 +1635,3 @@ CURLcode Curl_resolver_error(struct Curl_easy *data, const char *detail)
return result;
}
#endif /* USE_CURL_ASYNC */
#ifdef DEBUGBUILD
#include "curlx/wait.h"
void Curl_resolve_test_delay(void)
{
const char *p = getenv("CURL_DNS_DELAY_MS");
if(p) {
curl_off_t l;
if(!curlx_str_number(&p, &l, TIME_T_MAX) && l) {
curlx_wait_ms((timediff_t)l);
}
}
}
#endif