-
Notifications
You must be signed in to change notification settings - Fork 37.7k
Use async name resolving to improve net thread responsiveness #4421
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
Conversation
In the LookupIntern(), things changed are: 1. Call getaddrinfo_a() instead of getaddrinfo() if available, the former is a sync version of the latter; 2. Try using inet_pton()/inet_addr() to convert the input text to a network addr structure at first, if success the extra name resolving thread inside getaddrinfo_a() could be avoided; 3. An interruption point added in the waiting loop for return from getaddrinfo_a(), which completes the improve for thread responsiveness. A easy way to see the effect is to kick off a 'bitcoind stop' immediately after 'bitcoind -daemon', before the change it would take several, or even tens of, minutes on a bad network situation to wait for the running bitcoind to exit, now it costs only seconds. Signed-off-by: Huang Le <4tarhl@gmail.com>
Automatic sanity-testing: PASSED, see http://jenkins.bluematt.me/pull-tester/p4421_caf6150e9785da408f1e603ae70eae25b5202d98/ for binaries and test log. |
Untested ACK. The current behavior is very annoying, and this looks like a pretty clear improvement with very little added complexity. Nit: really the headers should be checked as well in configure, but realistically the lib checks should work on all reasonable platforms. |
Agreed @theuni BTW to rebase a pull you do not need to resubmit it. You can re-push to the same branch on github to update the current pull. |
@laanwj Yes I know that, I re-submit since I feel it is "cleaner" when just one commit included in one PR:) |
You still don't need to resubmit for that. If you rebase and force-push (push -f) you'll only have the commits that exist in your remote repository. |
Anyhow the code changes look good to me, going to test it. |
@laanwj Got it. Will try that next time... |
I've tested this for a week. No apparent problems. ACK. |
caf6150 Use async name resolving to improve net thread responsiveness (Huang Le)
#endif | ||
|
||
#ifdef HAVE_INET_PTON | ||
#include <arpa/inet.h> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
gitian-win fails to build on this see #4473
Reverting in #9229 due to glibc bugs in getaddrinfo_a. |
NOTE: This is a re-submit of PR 4259, just re-base to latest master for avoiding merge conflct, no real change was made. The previous discussion could be checked here: #4259.
In the LookupIntern(), things changed are:
A easy way to see the effect is to kick off a 'bitcoind stop' immediately after 'bitcoind -daemon', before the change it would take several, or even tens of, minutes on a bad network situation to wait for the running bitcoind to exit, now it costs only seconds.
Signed-off-by: Huang Le 4tarhl@gmail.com