stacks-network / stacks-core

The Stacks blockchain implementation
https://docs.stacks.co
GNU General Public License v3.0
3.01k stars 664 forks source link

Caught Exception from bitcoind: EOF occurred in violation of protocol #122

Closed peacekeeper closed 8 years ago

peacekeeper commented 9 years ago

getting this a lot after starting a fresh instance of blockstored:

[8221] Caught Exception from bitcoind
[ERROR] [transactions:155] (8206) [Errno 8] _ssl.c:510: EOF occurred in violation of protocol
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/virtualchain-0.0.2-py2.7.egg/virtualchain/lib/blockchain/transactions.py", line 144, in getblockhash
    block_hash = bitcoind.getblockhash( block_number )
  File "build/bdist.linux-x86_64/egg/bitcoinrpc/authproxy.py", line 112, in __call__
    'Content-type': 'application/json'})
  File "/usr/lib/python2.7/httplib.py", line 979, in request
    self._send_request(method, url, body, headers)
  File "/usr/lib/python2.7/httplib.py", line 1013, in _send_request
    self.endheaders(body)
  File "/usr/lib/python2.7/httplib.py", line 975, in endheaders
    self._send_output(message_body)
  File "/usr/lib/python2.7/httplib.py", line 835, in _send_output
    self.send(msg)
  File "/usr/lib/python2.7/httplib.py", line 797, in send
    self.connect()
  File "/usr/local/lib/python2.7/dist-packages/virtualchain-0.0.2-py2.7.egg/virtualchain/lib/blockchain/session.py", line 84, in connect
    self.sock = ssl.wrap_socket( sock, cert_reqs=ssl.CERT_NONE )
  File "/usr/lib/python2.7/ssl.py", line 487, in wrap_socket
    ciphers=ciphers)
  File "/usr/lib/python2.7/ssl.py", line 243, in __init__
    self.do_handshake()
  File "/usr/lib/python2.7/ssl.py", line 405, in do_handshake
    self._sslobj.do_handshake()
SSLError: [Errno 8] _ssl.c:510: EOF occurred in violation of protocol
[DEBUG] [session:95] (8206) [8221] Connect to bitcoind at https://openname@btcd.onename.com:8332
jcnelson commented 9 years ago

@peacekeeper This can happen when there is intermittent network jitter, or if the bitcoind fleet we're running in AWS is under particularly high load. It shouldn't affect the correctness of the system--Blockstore simply retries whatever RPC it issued whenever it encounters a network-level error such as this.

What I can do is have Blockstore avoid logging recoverable errors such as this.

peacekeeper commented 9 years ago

Thanks for the explanation, good to know this doesn't break anything. Interestingly I believe I also saw the same errors when setting "use_https = False", but I can't confirm that right now, would have to check again.

jfeldis commented 9 years ago

I saw this same/simliar error on both Bitseed and my intel machine when i built blockstore for them last night. I am using a local bitcoind txindex=1 in both cases. Blockstored was able to talk my local bitcoind in the past.

The error repeats infinitely

upon running blockstored start:

[INFO] blockstored:1106 Starting blockstored server ... [DEBUG] session:95 [23010] Connect to bitcoind at http://bitcoinrpc@12 7.0.0.1:8332 [ERROR] indexer:708 [Errno 8] _ssl.c:510: EOF occurred in violation of protocol Traceback (most recent call last): File "/usr/local/lib/python2.7/dist-packages/virtualchain-0.0.2-py2.7.egg/virt ualchain/lib/indexer.py", line 704, in get_index_range current_block = int(bitcoind.getblockcount()) File "/usr/local/lib/python2.7/dist-packages/bitcoinrpc/authproxy.py", line 11 2, in call 'Content-type': 'application/json'}) File "/usr/lib/python2.7/httplib.py", line 973, in request self._send_request(method, url, body, headers) File "/usr/lib/python2.7/httplib.py", line 1007, in _send_request self.endheaders(body) File "/usr/lib/python2.7/httplib.py", line 969, in endheaders self._send_output(message_body) File "/usr/lib/python2.7/httplib.py", line 829, in _send_output self.send(msg) File "/usr/lib/python2.7/httplib.py", line 791, in send self.connect() File "/usr/local/lib/python2.7/dist-packages/virtualchain-0.0.2-py2.7.egg/virt ualchain/lib/blockchain/session.py", line 84, in connect self.sock = ssl.wrap_socket( sock, cert_reqs=ssl.CERT_NONE ) File "/usr/lib/python2.7/ssl.py", line 487, in wrap_socket ciphers=ciphers) File "/usr/lib/python2.7/ssl.py", line 243, in init self.do_handshake() File "/usr/lib/python2.7/ssl.py", line 405, in do_handshake self._sslobj.do_handshake()

....repeats forever....

jcnelson commented 9 years ago

@peacekeeper @jfeldis When you get a chance, please post your ~/.blockstore/blockstore.ini files (with your secrets omitted), so I can try to reproduce the problem on my machine. Thanks!

peacekeeper commented 9 years ago
[bitcoind]
passwd = opennamesystem
server = btcd.onename.com
port = 8332
use_https = True
user = openname

[blockcypher]
api_token = -- omitted --

[dht]
disable = True
port = 6265
servers = dht.blockstack.org:6265,dht.onename.com:6265,dht.halfmoonlabs.com:6265,127.0.0.1:6265
jfeldis commented 9 years ago

Bitseed device (armhf)

[bitcoind] passwd = xxxxxxx server = 127.0.0.1 port = 8332 use_https = False user = bitcoinrpc

[chain_com] api_key_secret = xxxxx api_key_id = xxxxx

[dht] disable = True port = 6265 servers = dht.openname.org:6265,dht.onename.com:6265,dht.halfmoonlabs.com:6265,127.0.0.1:6265


x86-64 PC ubuntu 14

[chain_com] api_key_id = xxxxx api_key_secret = xxxxx

[bitcoind] server = 127.0.0.1 port = 8332 user = btcuser passwd = xxxxxxxxxxxxxxxxxxxxxx use_https = n

jcnelson commented 8 years ago

Should be fixed now; reopen if not.