Open robertsdotpm opened 10 years ago
Unless it really is that the connection has been open too long. I haven't exactly tried to time things.
I see the same error, Ubuntu 15.10, Python 2.7
Might be related to #txns in memory on the node, causing low memory condition. I feel core doesn't handle memory efficiently.
Redefining Authserviceproxy doesn't work for me. This issue is really driving me crazy.
Okay so if it fails you can reboot the daemon and then like robertsdotpm said and then you say like: Proxy = AuthServiceProxy(url) Then you need to repeat this EVERY time you fail. A single failure will throw it off forever until its called again at least in my experience. Would be nice to see this bug resolved. This is the only workaround I've come up with
@dzimbeck Restarting the daemon is a time/memory expensive way to get around the problem. Instead if you structure your python script to 'fall through' and exit after a set of RPC commands is executed; you can simply set your python to be continually re-executed in a small looping bash script. This way you get around the issue where redefining AuthServiceProxy doesn't wake the connection back up. I don't believe it is the daemon. Check the moonaudit script in my repo.
Thanks yeah I see that I can just try catch and then when it gets disconnected, just redeclare the authproxy. If that doesn't fire it back up your solution works. You are right, no need to restart the daemon.
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.