curl-library
synchronous i/o code inside of curl_easy_init() using c-ares
Date: Fri, 02 Feb 2018 17:24:21 +0300
Hi!
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 ares_init_options().
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 fileops.c:1418
3 __GI__IO_fread (buf=<optimized out>, size=1, count=31, fp=0x7f05bc1e4060) at iofread.c:42
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
Received on 2018-02-02