RPC interface hangs on getaccountaddress with empty wallet #185

issue javgh opened this issue on April 24, 2011
  1. javgh commented at 7:15 PM on April 24, 2011: none

    If "getaccountaddress" is the first RPC method to be called on an empty wallet, it will hang and crash the RPC interface. To reproduce:

    1. remove wallet.dat
    2. start "./bitcoind"
    3. check if running with "./bitcoind help"
    4. run "./bitcoind getaccountaddress foo"
    5. observe that the call never returns

    Note: This will not happen, if you call "getinfo" or "getnewaddress" (and possibly others) before the call to getaccountaddress.

    Some debugging shows the hang to happen on line 348 in rpc.cpp when GetKeyFromKeyPool() is called.

  2. javgh commented at 9:21 PM on April 24, 2011: none

    This is on Debian Squeeze, with libdb4.7 and build with USE_UPNP undefined

  3. javgh commented at 11:57 PM on April 24, 2011: none

    ArtForz was able to track this down further: The problem is that GetAccountAddress() in rpc.cpp starts an atomic db operation with walletdb.TxnBegin(); If may then happen, that GetKeyFromKeyPool() is called and when the key pool is not topped up, new keys will be generated and written to the database. This write operation then blocks, presumably waiting for the atomic operation to be completed.

    I'm not sure what a good solution would be. I tried a workaround here: https://github.com/javgh/bitcoin/commit/1049dc625f7b1d695092de72ad0c5bb7d329edfa That contains a method to top up the key pool separately and does though before starting the atomic db operation.

  4. javgh closed this on Apr 24, 2011

  5. javgh reopened this on Apr 24, 2011

  6. tcatm commented at 10:47 AM on August 28, 2011: none

    Seems to be fixed. I can't reproduce it anymore.

  7. tcatm closed this on Aug 28, 2011

  8. ptschip referenced this in commit 3f60f8b073 on Dec 22, 2016
  9. attilaaf referenced this in commit 0fda173de1 on Jan 13, 2020
  10. cryptapus referenced this in commit 7bd2c68f59 on May 3, 2021
  11. MarcoFalke locked this on Sep 8, 2021

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-13 21:16 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me