Estoy ejecutando pruebas unitarias contra bitcoind que realizan solicitudes JSON-RPC a una tasa alta. Las fallas aleatorias son un problema. Por ejemplo, si tiene algo como esto en los registros de printconsole:
ThreadRPCServer method=gettransaction
ThreadRPCServer method=gettransaction
ThreadRPCServer method=gettransaction
ThreadRPCServer method=gettransaction
....
ThreadRPCServer method=gettransaction
ThreadRPCServer method=gettransaction
sending: inv (37 bytes)
ThreadRPCServer method=gettransaction
ThreadRPCServer method=listtransactions
sending: inv (37 bytes)
Empiezas a recibir:
synced with network?".format(name)) from e
cryptoassets.core.backend.bitcoind.BitcoindJSONError: Got timeout when doing bitcoin RPC call listtransactions.
He intentado reutilizar la conexión HTTP y no reutilizar la conexión HTTP con varios resultados.
¿Hay algún fruto al alcance de la mano para hacer que la bitcoind
interfaz de RPC sea más estable (aumentar los hilos, la concurrencia, etc.?)
Estoy usando la siguiente implementación de Python JSON-RPC:
https://github.com/jgarzik/python-bitcoinrpc/blob/master/bitcoinrpc/authproxy.py
ACTUALIZACIÓN: Parece que la llamada problemática podría ser listtransactions
. Cuando se llama al mismo tiempo desde la línea de comando, curl
tampoco hay respuesta:
[~]% curl --user foo:bar --data-binary '{"id":"t0", "method": "listtransactions", "params": ["cryptoassets"] }' http://127.0.0.1:8332/ |python -m json.tool
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:--100 70 0 0 100 70 0 58
Usé BitcoinLib para realizar 15.000 listtransactions
llamadas consecutivas y el resultado fue:
0 timeouts
Fastest response: 0.1133479 sec
Slowest response: 0.6475277 sec
bitcoind
se inició con los parámetros predeterminados y recibió bloques durante la prueba.
mikko ohtamaa
rpcthreads=64
parece solucionar el problema, pero no explica lo que está sucediendo.