Tons of Socks5() connect to x.x.x.x:8333 failed: connection refused-messages when i use TOR - why? #29759

issue kosuodhmwa openend this issue on March 28, 2024
  1. kosuodhmwa commented at 5:27 pm on March 28, 2024: none

    Is there an existing issue for this?

    • I have searched the existing issues

    Current behaviour

    Gets tons of Socks5() connect to x.x.x.x:8333 failed: connection refused-messages

    Expected behaviour

    No messages like that

    Steps to reproduce

    • install tor via apt-get

    • add that to /etc/tor/torrc file: ControlPort 9051 CookieAuthentication 1 CookieAuthFileGroupReadable 1

    • restart tor service

    • add that to ~/.bitcoin/bitcoin.conf file: proxy=127.0.0.1:9050 listen=1 bind=127.0.0.1

    • start bitcoind service

    Relevant log output

    Many lines like that:

    Socks5() connect to x.x.x.x:8333 failed: connection refused

    How did you obtain Bitcoin Core

    Compiled from source

    What version of Bitcoin Core are you using?

    Most current

    Operating system and version

    Debian 12.5.x

    Machine specifications

    Oracle VirtualBox VM, Debian 12.5.x on Windows 10 Pro x64 Host System

  2. kosuodhmwa commented at 5:34 pm on March 28, 2024: none

    Installed as described on https://en.bitcoin.it/wiki/Setting_up_a_Tor_hidden_service AND

    1.) “usermod -a -G debian-tor BITCOIN_USER” instead of “usermod -a -G tor BITCOIN_USER”

    2.) Then a OS restart after that user / group permission change thing

  3. kosuodhmwa commented at 5:35 pm on March 28, 2024: none
    (BITCOIN_USER = root)
  4. kosuodhmwa commented at 5:37 pm on March 28, 2024: none
    Maybe the problem is that IPv6 is disabled via sysctl.conf on that system?
  5. kosuodhmwa commented at 5:38 pm on March 28, 2024: none
    Similar problem here? #25094
  6. kosuodhmwa commented at 5:47 pm on March 28, 2024: none
    image
  7. maflcko added the label Utils/log/libs on Mar 28, 2024
  8. kosuodhmwa commented at 10:13 pm on March 29, 2024: none
    Nobody knows what the problem is?
  9. pinheadmz commented at 10:17 pm on March 29, 2024: member
    What exact commit did you compile from? Does it include #29649 ?
  10. kosuodhmwa commented at 10:18 pm on March 29, 2024: none
    How can i get the version number from the source i’ve got from master GIT repo i’ve compiled?
  11. pinheadmz commented at 10:27 pm on March 29, 2024: member

    git rev-parse HEAD

    On Fri, Mar 29, 2024 at 6:19 PM Patrick Meier @.***> wrote:

    How can i get the version number from the source i’ve got from master GIT repo i’ve compiled?

    — Reply to this email directly, view it on GitHub https://github.com/bitcoin/bitcoin/issues/29759#issuecomment-2027787133, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAP46KDMFYCP5IMQHMOLDOLY2XLEVAVCNFSM6AAAAABFNGD3QCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMRXG44DOMJTGM . You are receiving this because you commented.Message ID: @.***>

  12. mzumsande commented at 6:53 pm on April 1, 2024: contributor

    I also get these errors sometimes when running with Tor. While they appear on some outgoing connection attempts, other connections are successful, so there seems to be nothing wrong on my end fundamentally. While a timout does not lead to a log entry in debug.log, answers from the SOCKS5 proxy with “general failure” and “connection refused” are logged, and it is not clear to me when which of the three happens.

    So I wonder if this happens every time and you can’t make successful connections, or only sporadically (in which case the only problem might be overzealous logging).

  13. badasserry39 referenced this in commit 3215d181a0 on Apr 2, 2024
  14. vasild commented at 3:34 pm on April 2, 2024: contributor

    As @mzumsande mentioned above, some errors like these are normal because they are printed whenever we fail to connect to a Tor peer. Not all Tor peers are online all the time. Does bitcoin-cli getpeerinfo show that you have at least one outbound connection to a Tor node? With some filtering: bitcoin-cli getpeerinfo |jq 'map(select(.inbound == false and .network == "onion")) |map({connection_type: .connection_type, addr: .addr, network: .network})'.

    If you cannot establish any connection to a Tor node, then there is a real problem in your setup.

    Socks5() connect to x.x.x.x:8333 failed: connection refused

    This error comes from the Socks5 proxy (aka the Tor daemon) if it cannot connect to the destination we asked for. Do you get only IP addresses in those messages (x.x.x.x) or also onion addresses (e.g. ydvbxdzs6w5wefifiqsqntpbd7tliofenqih5hlnz34546fvy4ab7iid.onion)?

    There is an inconsistency wrt logging connection failures: IPv4 and IPv6 connection failures are logged only if running with -debug=net: https://github.com/bitcoin/bitcoin/blob/3b987d03a49964995dced76889634561fd363d28/src/netbase.cpp#L551 https://github.com/bitcoin/bitcoin/blob/3b987d03a49964995dced76889634561fd363d28/src/netbase.cpp#L574 whereas Tor connection failures are logged as errors unconditionally: https://github.com/bitcoin/bitcoin/blob/3b987d03a49964995dced76889634561fd363d28/src/netbase.cpp#L448

    PS this is different from #25094 - the current issue is about errors when trying to establish outbound connections. That issue is about not being able to accept incoming connections (because we couldn’t communicate properly to the Tor daemon where to redirect those incoming connections to).

  15. mzumsande commented at 8:50 am on April 3, 2024: contributor
    For me, the Tor daemon also behaves inconsistently (Ubuntu). If I attempt to make a connection to one and the same non-reachable node (with addnode and onetry), I sometimes get a IntrRecvError::Timeout (which is not logged unconditionally), and sometimes get an error (Socks5() connect to x.x.x.x:8333 failed: general failure). I haven’t been able to detect a pattern which of the two happens when, it looks random to me. From reading the code, I get the impression that the original assumption was that if the peer is not online, the Socks5 proxy returns a timeout instead of a failure - which isn’t always the case for me.
  16. kosuodhmwa commented at 11:45 am on April 3, 2024: none
    The source code from the master branch i’ve compiled is: root@debian-12-btc-node:~/bitcoin# git rev-parse HEAD gives me the following output: 0fa9f17332a6d9b2eb6e3d9f9102bfd2d9c6f516
  17. kosuodhmwa commented at 11:46 am on April 3, 2024: none
    0fa9f17332a6d9b2eb6e3d9f9102bfd2d9c6f516
  18. kosuodhmwa commented at 9:08 pm on April 3, 2024: none

    image Now i saw that i also have message like that:

    2024-04-03T20:43:47Z Socks5() connect to 77.7.121.181:8333 failed: general failure

    Will start “bitcoind” now with filtering for that Tor Socks5 messages: ./bitcoind | grep Socks5

  19. kosuodhmwa commented at 9:22 pm on April 3, 2024: none

    “Do you get only IP addresses in those messages (x.x.x.x) or also onion addresses (e.g. ydvbxdzs6w5wefifiqsqntpbd7tliofenqih5hlnz34546fvy4ab7iid.onion)?”

    No, only for IP addresses as shown on post above. (other kind of message, but same host / ip and also same port) @vasild

  20. kosuodhmwa commented at 4:14 pm on April 5, 2024: none
    sn
  21. kosuodhmwa commented at 2:06 am on April 18, 2024: none

    Maybe it’s an idea to check these servers (they will be listed via console output) via “telnet [IP_ADDRESS] 8333”…

    If i dont get an anwser from telnet (TCP), then the problem is on these hosts / servers. If i get an answser, there is a problem on my side

  22. vasild referenced this in commit 7524aaf58f on May 8, 2024
  23. vasild commented at 2:48 pm on May 8, 2024: contributor

    There is an inconsistency wrt logging connection failures…

    Addressed in https://github.com/bitcoin/bitcoin/pull/30064

  24. kosuodhmwa commented at 5:43 pm on May 8, 2024: none
    ok thx
  25. vasild referenced this in commit f3cfbd65f5 on May 31, 2024
  26. kosuodhmwa commented at 5:47 pm on June 1, 2024: none
    closed
  27. kosuodhmwa closed this on Jun 1, 2024

  28. kosuodhmwa commented at 6:09 pm on July 28, 2024: none
    -> easy to bypass with <./bitcoind | grep -v -e ‘Socks5’>

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-12-03 15:12 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me