jgarzik/python-bitcoinrpc

Socket timeouts under heavy load

Closed this issue · 2 comments

It would be nice if the readme had an easy quickstart option to increase the socket timeout. Under heavy load this happens altogether too regularly:

File "/scratch/tmagik/gztx/bitcoinrpc/authproxy.py", line 179, in _get_response
    http_response = self.__conn.getresponse()
  File "/usr/lib/python3.4/http/client.py", line 1208, in getresponse
    response.begin()
  File "/usr/lib/python3.4/http/client.py", line 380, in begin
    version, status, reason = self._read_status()
  File "/usr/lib/python3.4/http/client.py", line 342, in _read_status
    line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
  File "/usr/lib/python3.4/socket.py", line 374, in readinto
    return self._sock.recv_into(b)
socket.timeout: timed out

answer: 'timeout=120' argument

rpc_connection = AuthServiceProxy(
        "http://%s:%s@%s:%s"%(rpc_user, rpc_password, rpc_host, rpc_port),
        timeout = 120
        )

README patch welcome!