jgarzik / jgarzik/python-bitcoinrpc

socket.timeout: timed out

Open
#33 6 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
663
Forks
300
PR merge metrics
No merged PRs in 30d

Description

Under Python 3.3, Ubuntu 14.04 I use the following code:
from bitcoinrpc.authproxy import AuthServiceProxy
x = AuthServiceProxy("....")
x.rpc_calls(...)

The Bitcoin RPC version I'm using is from the latest master branch.

Anyway, here is my observation: After making at least one successful RPC call the library will randomly throw a timeout exception that looks like this:
Original exception was:
Traceback (most recent call last):
File "", line 1, in
File "/usr/local/lib/python3.3/dist-packages/bitcoinrpc/authproxy.py", line 116, in **call**
response = self._get_response()
File "/usr/local/lib/python3.3/dist-packages/bitcoinrpc/authproxy.py", line 138, in _get_response
http_response = self.__conn.getresponse()
File "/usr/lib/python3.3/http/client.py", line 1147, in getresponse
response.begin()
File "/usr/lib/python3.3/http/client.py", line 358, in begin
version, status, reason = self._read_status()
File "/usr/lib/python3.3/http/client.py", line 320, in _read_status
line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
File "/usr/lib/python3.3/socket.py", line 297, in readinto
return self._sock.recv_into(b)
socket.timeout: timed out

I'm just wondering what the reason is for the timeout. It seems my Bitcoind daemon is never actually down. After the timeout occurs I can't issue any more RPC commands without the same exception but if I immediately reconnect with x = AuthServiceProxy("....") and issue the same failed RPC call it ends up working.

An obvious fix is to use a wrapper, but I'm wondering if it's a problem with this library or what reasons there are for this error.

I have confirmed the bug exists under multiple Python versions and multiple coind versions (hosted locally and remotely.) The RPC connection doesn't necessarily need to be open for a long time before the timeout occurs and there doesn't seem to be any pattern to the error.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.