News for hackers. Stuff that matters.
Re:RIP pthread_cancel by blaz0 on Sunday September 14, 2025 @12:45AM (#45237513)
I'm the author of the GitHub issue that the blog links to, and I'd like to thank Stefan for quickly acknowledging the problem and addressing the issue! I try to keep one of our internal applications up to date with the latest libcurl version within a day or two of a release, so we sometimes hit fresh problems while running our battery of tests.

Ironically, our application has also struggled with blocking DNS resolution in the past, so I appreciate the discussion here. In case anyone is interested, here is a quick reference of the different asynchronous DNS resolution methods that you can use in a native code application for some of the most popular platforms:

  - Windows/Xbox: GetAddrInfoExW / GetAddrInfoExCancel
  - macOS/iOS: CFHostStartInfoResolution / CFHostCancelInfoResolution
  - Linux (glibc): getaddrinfo_a / gai_cancel
  - Android: android.net.DnsResolver.query (requires the use of JNI)
  - PS5: proprietary DNS resolver API
Re:RIP pthread_cancel by wolletd on Sunday September 14, 2025 @04:48AM (#45238473)
This information about `getaddrinfo_a` should probably also be in the Github issue?
Re:RIP pthread_cancel by somat on Sunday September 14, 2025 @08:24AM (#45239294)
If we are doing a survey. I found a few more. It feels like we need to get everyone together in a room and say "we will let you out when you decide on a standard non-blocking address lookup" What a mess.

  - OpenBSD: getaddrinfo_async / asr_abort https://man.openbsd.org/asr_run
  - FreeBSD: dnsres_getaddrinfo / found no way to abort https://man.freebsd.org/cgi/man.cgi?query=dnsres
Re:RIP pthread_cancel by jnwatson on Sunday September 14, 2025 @11:07AM (#45240327)
As the article mentions, why not just delegate it to a library dedicated to the solution? c-ares is a solid, well-maintained library.
Re:RIP pthread_cancel by JosifA on Sunday September 14, 2025 @02:12PM (#45242000)
Unfortunately, c-ares is not problem-free on all platforms.

On iOS, its use triggers a local network access popup (it tries to reach your DNS server, which is often on your LAN). If a user denies acess, your app will simply not work.

On Android, it's not compatible with some VPN apps. Those apps are to blame, but your users are going to blame you not them.

So, at my previous company we ended up building libcurl with a threaded DNS resolver on both iOS and Android.