Why does getNewAddress take so long? Often times out python-bitcoinrpc



Bitcoin 0.11 on a Raspberry Pi 2:


I am using this RPC auth proxy to talk to bitcoind from Python. I have a script that requests getmempoolinfo every 1 second. Occasionally given user input a new address is needed, and the script requests getnewaddress. This RPC-call often times out.

Sometimes the time-out causes even weirder behavior in other RPC calls until python is interrupted and the script killed: for example, getmempoolinfo returns the same information every time it is called until the script is restarted. Even querying bitcoind from the command line in a separate terminal window bitcoin-cli getmempoolinfo indicates that the mempool is not growing at all until the script that timed-out calling getnewaddress is terminated.

I also notice from the command line bitcoin-cli getnewaddress can take up to 30 seconds, without any python scripts running or other in-progress RPC calls.

I thought bitcoind is just retrieving a new address from wallet.dat, what is taking so long? It's not decrypting the wallet, it's not generating a whole new address from entropy... yet this specific RPC call is causing me lots of downstream problems.


Posted 2016-02-08T04:42:15.440

Reputation: 4 072

1How large is your wallet, in keys/transactions/megabytes? – Pieter Wuille – 2016-02-08T11:13:21.857

101 keys, 0 transactions. I wonder if it's disk io? The wallet and the blockchain are both on the same USB flash drive. – pinhead – 2016-02-08T15:17:38.267

Wallet.dat is 294 kb. Interesting, command line dumpwallet works instantly. – pinhead – 2016-02-08T15:23:06.563

Please report this as a bug in that case: https://github.com/bitcoin/issues.

– Pieter Wuille – 2016-02-08T15:28:51.820

https://github.com/bitcoin/bitcoin/issues/7486 – pinhead – 2016-02-09T00:05:03.397

Judging from the discussion on github, you probably have found out what the issue was. Could you please summarize your findings by answering your own question for other users that find this question later? – Murch – 2016-02-11T10:37:13.900

@Murch I'm still working on it... – pinhead – 2016-02-11T17:45:51.407

Oh, sorry, it appeared to me that it would probably have been the USB stick. Nevermind then! Good luck. – Murch – 2016-02-11T17:48:51.693

@Murch last night I switched out the stick with an SSD drive, a lot of things went faster but I think there's another process running on my Pi that is still making getnewaddress timeout - even up to 45 minutes! I'm using the Pi's GPIO to drive an LED matrix. – pinhead – 2016-02-11T17:50:02.683

Oh wow, that's too bad. Hope you'll figure it out. – Murch – 2016-02-11T17:50:51.950



The problem has to do with other processes on the computer with too high CPU priority:



Posted 2016-02-08T04:42:15.440

Reputation: 4 072