Skip to content
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

'ERROR: Error reading proxy response' when using TOR on bitcoind #9430

Closed
ghost opened this issue Dec 26, 2016 · 13 comments
Closed

'ERROR: Error reading proxy response' when using TOR on bitcoind #9430

ghost opened this issue Dec 26, 2016 · 13 comments

Comments

@ghost
Copy link

ghost commented Dec 26, 2016

Describe the issue

The problem is, the error message: 'ERROR: Error reading proxy response' in the debug.log file.
I wanted to simply run bitcoin over TOR. So in the bitcoin.conf file i had the following lines:
bind=127.0.0.1
port=8333
upnp=0
proxy=127.0.0.1:9050

Then i started bitcoind in terminal, i monitored the debug.log file and i saw that error message described above every minute or so while i was getting a new 'update tip' block.

To test if TOR was really working, i stopped the TOR service and i immediately got countless errors:
connect() to 127.0.0.1:9050 failed after select(): Connection refused (111)
connect() to 127.0.0.1:9050 failed after select(): Connection refused (111)
connect() to 127.0.0.1:9050 failed after select(): Connection refused (111)

So i realized that TOR was working, yet the original unknown error of:
'ERROR: Error reading proxy response' occurred.

Please note: my intention was not to use a hidden tor service.
My intention was to simply torify outgoing connections as described in the first step here:
https://github.com/bitcoin/bitcoin/blob/master/doc/tor.md#1-run-bitcoin-behind-a-tor-proxy
and here:
https://bitcointalk.org/index.php?topic=623868.0

Expected behaviour

The expected behaviour should have been that bitcoin would run over tor without a proxy error while tor is actually working.

What version of bitcoin-core are you using?

sudo apt-add-repository ppa:bitcoin/bitcoin (https://launchpad.net/~bitcoin/+archive/ubuntu/bitcoin)
sudo apt-get install bitcoind

Machine specs:

  • OS: Ubuntu 16.04
  • Disk Type (HD/SDD): SSD

If there should be some other type of config that i am missing in bitcoin.conf please let me know.

@unsystemizer
Copy link
Contributor

You need to fix your proxy. Unless you can show other apps work with that proxy and Bitcoin does not, it's not a Bitcoin issue. Similar eample:
bitcoin-dot-org/Bitcoin.org#1334
Perhaps you should fix Tor first and make sure that it works as SOCKS5 proxy. At the moment you only demonstrate that the proxy is refusing connections, and not that Bitcoin is not functioning properly

@ghost
Copy link
Author

ghost commented Dec 27, 2016

Well the thing is, i do use the TOR daemon for other apps and it works perfectly in Ubuntu. Thats why I am reporting this issue. Can you please try and reproduce the issue?

I can try reproduce the issue on a newly installed Ubuntu 16.04 with TOR installed and report back.

@unsystemizer
Copy link
Contributor

unsystemizer commented Dec 28, 2016

Are those other apps using Tor SOCKS5 proxy?
I had Bitcoin 0.12.1 running with Tor on Ubuntu 16.04 before and I had to fix my proxy settings on Tor to get it to work.

Provide your Tor version and complete configuration files for Bitcoin and Tor - or better yet, get help on Tor forums.

@laanwj
Copy link
Member

laanwj commented Jan 2, 2017

If you get a message about connection refused, you have set the wrong port for your proxy. What port is tor really listening on?
Never mind, you get that after quitting tor, which makes sense.

@ghost
Copy link
Author

ghost commented Jan 2, 2017

@unsystemizer as far i know, the default TOR daemon installation does not require any configuration for simple outgoing connections to applications that support TOR.

I have tested this on a fresh installation of Ubuntu 16.04. installed tor and bitcoind.
as soon as i created the bitcoin.conf file and started bitcoind, initially i get exactly 2 error messages:
2017-01-02 ERROR: Error reading proxy response
2017-01-02 ERROR: Error reading proxy response

then all the update tips started downloading perfectly.
But again i mention, if i stop the tor service, and start bitcoind - it will flood the log with
connect() to 127.0.0.1:9050 failed after select(): Connection refused (111)

so my daemon IS working. because i can still use it with other apps such as torbirdy for example and there are no issues.

the fact that bitcoind works while TOR is running while receiving 2 random errors 'Error reading proxy response' and then continuing normally doesnt mean there is something wrong with tor. dont you think? but if the service is stopped i can understand the flood of error messages.

If you had to run a fresh VM of ubuntu and installed TOR and bitcoind, you will see for yourself. because i just reproduced the issue.
Id really appreciate it if you could reproduce the issue so you can see my exact problem.

the bitcoin.conf file that i create like i said, has the following lines:

bind=127.0.0.1
port=8333
upnp=0
proxy=127.0.0.1:9050

@ghost
Copy link
Author

ghost commented Jan 2, 2017

is the bitcoin.conf contents correct? the bind address and port is all right i suppose?

@sipa
Copy link
Member

sipa commented Jan 2, 2017 via email

@ghost
Copy link
Author

ghost commented Jan 2, 2017

They using 9050, which is used for the TOR daemon.
9150 is used when using tor browser bundle. thats about it.
I just tested now bitcoin.conf to use proxy=127.0.0.1:3050.. just to see the result in the debug.log. and it throws the error:
connect() to 127.0.0.1:3050 failed after select(): Connection refused (111)

so the port 9050 is not incorrect because if it was, it would throw the above error.
The fact that this error is thrown a couple times in the beginning: ERROR: Error reading proxy response but then continues normally, confuses me and makes me wonder, IS IT reading the proxy, is it half reading it or what is going on?

@ghost
Copy link
Author

ghost commented Jan 2, 2017

When i get this in debug.log:
receive version message: /Satoshi:0.13.1/: version 70014, blocks=446280, us=xx.xx.xx.xx:50597, peer=8 Without TOR, the us=xx.xx.xx.xx would show my original IP address, yet if i start bitcoind with TOR, then the us=xx.xx.xx.xx part would show foreign IP addresses. so TOR does work it seems, but the only question is, why is this error found seldomly within the log while downloading blocks?
ERROR: Error reading proxy response

@unsystemizer
Copy link
Contributor

unsystemizer commented Jan 2, 2017

the original unknown error of: 'ERROR: Error reading proxy response' occurred.

It's neither original nor unknown. In the first comment yesterday I gave you a link to the exact same issue and there the maintainers suggested it's a Tor configuration problem.

so the port 9050 is not incorrect because if it was, it would throw the above error.

That does not show your Tor SOCKS5 is properly configured and available for use. I told you yesterday: you fail to show that your Tor SOCKS5 proxy is usable without restrictions to any other client that uses the same settings as bitcoind.

I'm running 0.13 with Tor SOCKS5 proxy (Tor alpha channel) right now, no issues.

@laanwj
Copy link
Member

laanwj commented Jan 26, 2017

so the port 9050 is not incorrect because if it was, it would throw the above error.

Tor opens more ports than a proxy port (ControlPort, TransPort, DNSPort, to name a few, Tor bundles open a HTTP proxy as well). If you were to use the wrong port as SOCKS5 proxy, you'd get unexpected responses just like here.

There are many users of Bitcoin Core + Tor so everything suggests a local configuration issue on your end.

@laanwj
Copy link
Member

laanwj commented Feb 9, 2017

Looks like we've been chasing ghosts here. That error message "ERROR: Error reading proxy response" is also thrown when the connection attempt times out. This is incredibly common on Tor, especially when connecting to hidden services. Fixed in #9726.

@laanwj laanwj closed this as completed Feb 9, 2017
@ghost
Copy link
Author

ghost commented Feb 9, 2017

@laanwj thank you for getting to the bottom of this.

@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.
Projects
None yet
Development

No branches or pull requests

4 participants