-
Notifications
You must be signed in to change notification settings - Fork 308
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
socket.timeout: timed out #33
Comments
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: |
@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. |
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.
The text was updated successfully, but these errors were encountered: