We use libcurl in a project to handle >10K HTTP requests/second using multi 
interface via curl-asio C++ wrapper (https://github.com/mologie/curl-asio). If 
default threaded DNS resolver is used, curl_easy_init() is very fast; however, 
if I switch to c-ares, curl_easy_init() stucks in reading local files inside of 

An example stack trace is as following:

0 read () at ../sysdeps/unix/syscall-template.S:81
1 _IO_new_file_underflow (fp=0x7f05bc1e4060) at fileops.c:613
2 __GI__IO_file_xsgetn (fp=0x7f05bc1e4060, data=<optimized out>, n=31) at 
3 __GI__IO_fread (buf=<optimized out>, size=1, count=31, fp=0x7f05bc1e4060) at 
4 ares_init_options ()
5 Curl_resolver_init ()
6 Curl_open ()
7 curl_easy_init ()
8 curl::easy::init (this=0x7f05bc1e3f28) +504
9 curl::easy::easy (this=0x7f05bc1e3f28, multi_handle=...) +36

So, when I try to create easy handle and use it in async way, ares still does 
pretty much synchronous actions.
AFAICS, there is no option to disable re-reading of /etc/resolv.conf, 
/etc/hosts, etc.

Is it a deliberate decision to read these files synchronously?  Is it possible 
to use c-ares in libcurl and not to do any sync i/o in a client thread?
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette:   https://curl.haxx.se/mail/etiquette.html

Reply via email to