I'm having issues getting Electrum server to sync with bitcoind. It works fine for a short time then says this:
17/02/2013-05:20:34] catch_up: block 23100 (0.639s)
[17/02/2013-05:20:34] catch_up: block 23200 (0.638s)
Traceback (most recent call last):
File "/home/bitcoind/electrum/electrum-server/backends/bitcoind/blockchain_processor.py",$
respdata = urllib.urlopen(self.bitcoind_url, postdata).read()
File "/usr/lib/python2.7/urllib.py", line 88, in urlopen
return opener.open(url, data)
File "/usr/lib/python2.7/urllib.py", line 209, in open
return getattr(self, name)(url, data)
File "/usr/lib/python2.7/urllib.py", line 344, in open_http
h.endheaders(data)
File "/usr/lib/python2.7/httplib.py", line 954, in endheaders
self._send_output(message_body)
File "/usr/lib/python2.7/httplib.py", line 814, in _send_output
self.send(msg)
File "/usr/lib/python2.7/httplib.py", line 776, in send
self.connect()
File "/usr/lib/python2.7/httplib.py", line 757, in connect
self.timeout, self.source_address)
File "/usr/lib/python2.7/socket.py", line 571, in create_connection
raise err
IOError: [Errno socket error] [Errno 110] Connection timed out
[17/02/2013-05:20:56] Stopping Stratum
Exception in thread Thread-4:
Traceback (most recent call last):
File "/usr/lib/python2.7/threading.py", line 551, in __bootstrap_inner
self.run()
File "/usr/lib/python2.7/threading.py", line 755, in run
self.function(*self.args, **self.kwargs)
File "/home/bitcoind/electrum/electrum-server/backends/bitcoind/blockchain_processor.py",$
threading.Timer(0, lambda: self.catch_up(sync=False)).start()
File "/home/bitcoind/electrum/electrum-server/backends/bitcoind/blockchain_processor.py",$
next_block_hash = self.bitcoind('getblockhash', [self.height + 1])
File "/home/bitcoind/electrum/electrum-server/backends/bitcoind/blockchain_processor.py",$
r = loads(respdata)
UnboundLocalError: local variable 'respdata' referenced before assignment
Looks like a time out issue. I have it running on a virtual server that may be the source of the delays in communicating w/ bitcoind.
I don't speak python, but this seems to magically make the time out 60s instead of 1s:
electrum-server/backends/bitcoind/blockchain_processor.py line 87:
was:
try:
respdata = urllib.urlopen(self.bitcoind_url, postdata).read()
except:
traceback.print_exc(file=sys.stdout)
self.shared.stop()
Changed to:
try:
respdata = urllib.urlopen(self.bitcoind_url, postdata).read()
except:
try:
respdata = urllib.urlopen(self.bitcoind_url, postdata).read()
except:
traceback.print_exc(file=sys.stdout)
self.shared.stop()
After changing this, it runs much longer before it dies with the same message. I'm sure there's a much better way to do this. Maybe some who knows about this stuff can fix it or at least change the time out to a value that will survive the server being overloaded temporarily.
[Edit]
Moved leveldb to shm to see if it helped performance. It didn't. The issue appears to be caused by high cpu usage.