Skip to content

Conversation

TheBlueMatt
Copy link
Contributor

getaddrinfo_a has a nasty tendency to segfault internally in its
background thread, on every version of glibc I tested, especially
under helgrind.

See https://sourceware.org/bugzilla/show_bug.cgi?id=20874

@TheBlueMatt
Copy link
Contributor Author

This should probably be backported.

@laanwj
Copy link
Member

laanwj commented Nov 28, 2016

@theuni can you take a look here?

@@ -512,7 +512,6 @@ if test x$TARGET_OS = xdarwin; then
fi

AC_CHECK_HEADERS([endian.h sys/endian.h byteswap.h stdio.h stdlib.h unistd.h strings.h sys/types.h sys/stat.h sys/select.h sys/prctl.h])
AC_SEARCH_LIBS([getaddrinfo_a], [anl], [AC_DEFINE(HAVE_GETADDRINFO_A, 1, [Define this symbol if you have getaddrinfo_a])])
AC_SEARCH_LIBS([inet_pton], [nsl resolv], [AC_DEFINE(HAVE_INET_PTON, 1, [Define this symbol if you have inet_pton])])
Copy link
Member

@laanwj laanwj Nov 28, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting. It looks like this detection goes wrong on windows, and we only notice now because all uses were inside HAVE_GETADDRINFO_A.
On windows you apparently have to use InetPton: https://msdn.microsoft.com/en-us/library/windows/desktop/cc805844(v=vs.85).aspx
But this is only available on Vista and higher so the safest just to not use it on windows.

@laanwj
Copy link
Member

laanwj commented Nov 28, 2016

On windows 32 bit (works correctly there):

checking for library containing inet_pton... no

On windows 64 bit:

checking for library containing inet_pton... none required

What is this "none required"? It detects the symbol in the C library?
Maybe we need to check for include-ability as well?

Edit: I checked and apparently the symbol is in libws2_32.a but not in any include files. The correct check here would be to try compiling a program that uses the function, not just a library linkage check. My autotools-fu doesn't go that far though.

@fanquake
Copy link
Member

Looks like pretty much all the code being removed here was added in #4421

re 'none required'. See here - https://www.gnu.org/software/autoconf/manual/autoconf-2.69/html_node/Libraries.html
"The result of this test is cached in the ac_cv_search_function variable as ‘none required’ if function is already available"

@theuni
Copy link
Member

theuni commented Dec 1, 2016

No real preference here. I'm just a few PRs away from removing the current resolve/connection code in favor of async lookups/connections.

Given that our current connection model is very synchronous as-is, I've been curious for a while as to whether getaddrinfo_a is worth the trouble. So, concept ACK for nuke/backport.

@jonasschnelli jonasschnelli added this to the 0.14.0 milestone Dec 1, 2016
This reverts commit caf6150.

getaddrinfo_a has a nasty tendency to segfault internally in its
background thread, on every version of glibc I tested, especially
under helgrind.

See https://sourceware.org/bugzilla/show_bug.cgi?id=20874
@TheBlueMatt
Copy link
Contributor Author

Switched to a wholesale revert of #4421 as discussed in meeting.

@laanwj
Copy link
Member

laanwj commented Dec 2, 2016

I've managed to reproduce the issue and posted to the sourceware thread.
ACK 10ae7a7, prefer this as revert.

@laanwj laanwj merged commit 10ae7a7 into bitcoin:master Dec 2, 2016
laanwj added a commit that referenced this pull request Dec 2, 2016
10ae7a7 Revert "Use async name resolving to improve net thread responsiveness" (Matt Corallo)
@laanwj laanwj modified the milestones: 0.13.2, 0.14.0 Dec 2, 2016
laanwj pushed a commit that referenced this pull request Dec 2, 2016
This reverts commit caf6150.

getaddrinfo_a has a nasty tendency to segfault internally in its
background thread, on every version of glibc I tested, especially
under helgrind.

See https://sourceware.org/bugzilla/show_bug.cgi?id=20874

Github-Pull: #9229
Rebased-From: 10ae7a7
@laanwj
Copy link
Member

laanwj commented Dec 2, 2016

pushed to 0.13 branch as b172377, removing backport tag

codablock pushed a commit to codablock/dash that referenced this pull request Jan 17, 2018
10ae7a7 Revert "Use async name resolving to improve net thread responsiveness" (Matt Corallo)
lateminer pushed a commit to lateminer/bitcoin that referenced this pull request Oct 22, 2018
This reverts commit caf6150.

getaddrinfo_a has a nasty tendency to segfault internally in its
background thread, on every version of glibc I tested, especially
under helgrind.

See https://sourceware.org/bugzilla/show_bug.cgi?id=20874

Github-Pull: bitcoin#9229
Rebased-From: 10ae7a7
andvgal pushed a commit to energicryptocurrency/gen2-energi that referenced this pull request Jan 6, 2019
10ae7a7 Revert "Use async name resolving to improve net thread responsiveness" (Matt Corallo)
CryptoCentric pushed a commit to absolute-community/absolute that referenced this pull request Feb 25, 2019
10ae7a7 Revert "Use async name resolving to improve net thread responsiveness" (Matt Corallo)
random-zebra added a commit to PIVX-Project/PIVX that referenced this pull request Dec 14, 2020
d46b369 [net] Avoid initialization to a value that is never read Prior to this commit the value stored to `s` at initialization was never read (in the case of STRERROR_R_CHAR_P). (furszy)
f62d152 Revert "Use async name resolving to improve net thread responsiveness" (furszy)
a1b0017 Use Socks5ErrorString() to decode error responses from socks proxy. (furszy)
fdec2e3 Make Socks5() InterruptibleRecv() timeout/failures informative. Before: ERROR: Error reading proxy response (furszy)
2027d66 SOCKS5 connecting and connected messages with -debug=net.  They were too noisy and not necessary for normal operation. (furszy)
097322c Make failures to connect via Socks5() more informative and less unnecessarily scary.  * The "ERROR" was printed far too often during normal operation for what was not an error. (furszy)

Pull request description:

  Made a set of back ports to make Socks5 connection failures less noisy and less unnecessarily scary.
  Plus added a straightforward removal of `getaddrinfo_a` which was never available at configure time.

  Back ported PRs list:
  bitcoin#8033
  bitcoin#9229
  bitcoin#9539

ACKs for top commit:
  Fuzzbawls:
    utACK d46b369
  random-zebra:
    utACK d46b369 and merging...

Tree-SHA512: 5b79309a2bc9ffca686e00b431d8205c72c353a56693b7f1e7a0a7245b158032e9243a49fea10a606cb2329726b3908fd5187ac6c8e57ddd0e9025a9811950ec
@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