New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Async DNS resolution on Win8+ with GetAddrInfoExW #12481
Labels
Comments
see #12406 for pending "negative caching" |
By your description it certainly sounds like a worthwhile idea. Please do! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
I did this
I tried to run a test on Windows under asan where many fetches are tried when there is no internet. It appears that starting/exiting threads under asan leaks memory badly, it takes only a few seconds before all ram gets consumed.
I expected the following
Although, this isn't a bug in libcurl, but in my case I had to fix the issue. It seems that libcurl without c-ares always starts a thread for dns requests since dns was always blocking before Win8. Starting from Win8 there is a non-blocking version is available with GetAddrInfoExW.
Alternatively, libcurl could have cached failed dns results for a very short time to avoid redoing the same requests multiple times: for example, if 1000 requests are made to the same host while there is no connection instead of starting 1000 threads in 10ms doing the same failing dns request it would be better to cache failures for 10ms or 1ms.
In my case, I ended up writing code that uses GetAddrInfoExW on Win8. Let me know if it's something worth to add to libcurl, and I'll make a PR.
curl/libcurl version
curl 8.5.0
operating system
WIndows 8+
The text was updated successfully, but these errors were encountered: