jgarzik / jgarzik/python-bitcoinrpc
socket.timeout: timed out
- Lingua principale
- Python
- Stelle
- 663
- Fork
- 300
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
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.
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Direzione di ricerca
Start in bitcoinrpc/authproxy.py at the AuthServiceProxy call path and _get_response(), using the reported http.client traceback as the entry point. Reproduce a successful RPC call followed by the timeout and compare behavior with a newly created AuthServiceProxy connection; done means identifying the persistent-connection cause and defining a verified fix or documented handling.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- python
- Ambito
- api
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Da chiarire
- Idoneità per principianti
- 30/100