Skip to content

Conversation

4tar
Copy link
Contributor

@4tar 4tar commented Jun 26, 2014

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:

  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

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>
@BitcoinPullTester
Copy link

Automatic sanity-testing: PASSED, see http://jenkins.bluematt.me/pull-tester/p4421_caf6150e9785da408f1e603ae70eae25b5202d98/ for binaries and test log.
This test script verifies pulls every time they are updated. It, however, dies sometimes and fails to test properly. If you are waiting on a test, please check timestamps to verify that the test.log is moving at http://jenkins.bluematt.me/pull-tester/current/
Contact BlueMatt on freenode if something looks broken.

@theuni
Copy link
Member

theuni commented Jun 26, 2014

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.

@laanwj
Copy link
Member

laanwj commented Jun 26, 2014

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.

@4tar
Copy link
Contributor Author

4tar commented Jun 27, 2014

@laanwj Yes I know that, I re-submit since I feel it is "cleaner" when just one commit included in one PR:)

@laanwj
Copy link
Member

laanwj commented Jun 27, 2014

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.

@laanwj
Copy link
Member

laanwj commented Jun 27, 2014

Anyhow the code changes look good to me, going to test it.

@4tar
Copy link
Contributor Author

4tar commented Jun 29, 2014

@laanwj Got it. Will try that next time...

@laanwj
Copy link
Member

laanwj commented Jul 4, 2014

I've tested this for a week. No apparent problems. ACK.

@laanwj laanwj merged commit caf6150 into bitcoin:master Jul 4, 2014
laanwj added a commit that referenced this pull request Jul 4, 2014
caf6150 Use async name resolving to improve net thread responsiveness (Huang Le)
@4tar 4tar deleted the async_resolve branch July 6, 2014 15:18
@ghost ghost mentioned this pull request Jul 6, 2014
#endif

#ifdef HAVE_INET_PTON
#include <arpa/inet.h>
Copy link

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

@TheBlueMatt
Copy link
Contributor

Reverting in #9229 due to glibc bugs in getaddrinfo_a.

@bitcoin bitcoin locked as resolved and limited conversation to collaborators Sep 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants