Created
July 17, 2015 19:03
-
-
Save kanzure/57f1b50cf7fb82cc5c1a to your computer and use it in GitHub Desktop.
Replication of RPC thread hanging using bitcoind v0.10.2.0-g16f4560
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# start bitcoind in regtest mode | |
# ... set the following parameters: | |
# -rpcthreads=1 -rpctimeout=5 | |
# The behavior can be seen more readily with rpcthreads=1. | |
bitcoind -regtest -rcpthreads=1 -rpctimeout=5 -debug=1 -logtimestamps=1 -printtoconsole=1 -server=1 -listen=1 -maxconnections=500 -txindex=1 | |
# NOTE: Also, alertnotify and blocknotify scripts are being executed, although | |
# they don't seem to be necessary to trigger this behavior? | |
# using python-bitcoinlib in python3.4, although python-bitcoinrpc or even bitcoin-cli might work for this | |
from bitcoin.core import x, b2x, lx, b2lx | |
from bitcoin.rpc import Proxy | |
# connect to bitcoind and send some commands | |
proxy = Proxy() # or something | |
# mine some blocks, but don't wait for it to finish mining | |
bitcoin-cli setgenerate true 1000 | |
# despair... this will hang until bitcoind is done mining. | |
# Try keyboard interrupting this while it's hanging. If you do not | |
# keyboardinterrupt it, then the request will be completed eventually | |
# (although you may have to first proxy = Proxy() while setgenerate | |
# is running?). However, if you do keyboardinterrupt it, then all | |
# future rpc requests will fail. | |
proxy.getinfo() | |
# also you'll get failures using bitcoin-cli | |
bitcoin-cli getinfo | |
# bitcoind v0.10.2.0-g16f4560 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment