getbalance rpc call results in 100% cpu #3903

issue ghost opened this issue on March 19, 2014
  1. ghost commented at 5:48 PM on March 19, 2014: none

    bitcoind version: v0.9.0rc2-82-g98f4c6c-beta

    i haven't been able to run bitcoind getbalance on recent git versions. every time i try to, it results in 100% cpu and i have to kill and restart the daemon eventually. i've let it run for up to 10 minutes that way, but i can't afford to let it lock up my system for any longer than that to see how long it might take to finish, if it ever will. i'm wondering if this is related to #3661. i know my wallet has at least one double spend in it, because i've seen this message in my debug log: ERROR: AcceptToMemoryPool : inputs already spent.

  2. gmaxwell commented at 7:02 PM on March 19, 2014: contributor

    inputs already spent has nothing to do with the wallet.

    How many transactions are in this wallet roughly?

  3. ghost commented at 10:18 PM on March 19, 2014: none

    6700 unique txs. but i have several thousand addresses and many of the txs involve multiple addresses. if i count the total non-unique txs from the output of listreceivedbyaddress, the number is 400K.

    and for comparison, listreceivedbyaddress only took 110 seconds to complete.

  4. ghost commented at 10:24 PM on March 27, 2014: none

    I tried to workaround this problem by scripting a solution summing the amounts from listreceivedbyaddress, but the amounts are completely wrong- it's only 10% of the expected amount (which was verified with blockchain.info). listaccounts and listreceivedbyaccount are also reporting the same wrong amounts as well.

    So if the address amounts are wrong, the number of transactions I listed above are probably off as well.

  5. leofidus commented at 7:00 AM on March 28, 2014: none

    I had a similar problem when updating from 0.8.6 to 0.9.0. In my case, getinfo showed the same behaviour as getbalance (100% cpu usage, never completes). Running with -salvagewallet solved that but left me with a fraction of my funds (10% is about right). I worked around it by creating a new wallet, opening the old wallet in 0.6.8 and moving all funds over.

  6. laanwj commented at 8:25 AM on March 28, 2014: member

    The problem (also noted by @gavinandresen when he made the anti-malleability wallet changes for 0.9.0) is that we don't have any really busy wallets to test with.

    We would need such a wallet in the dev team to be able to profile / debug / optimize this.

  7. laanwj added the label Bug on Mar 28, 2014
  8. laanwj added the label Priority Medium on Mar 28, 2014
  9. gmaxwell commented at 5:08 PM on March 28, 2014: contributor

    If someone experiencing an extreme case of this problem (e.g. taking a minute or more) is able to build Bitcoin core for themselves and test the simple patch in pull #3973 it would be helpful. I'm not sure if it is the same problem here or not, but I think it may be.

  10. ghost commented at 4:16 AM on March 29, 2014: none

    Tested the patch and it works for me.

  11. gmaxwell commented at 4:52 AM on March 29, 2014: contributor

    BugAndNewsReporter: Can I understand that to mean that it made it much faster?

  12. ghost commented at 8:23 AM on March 29, 2014: none

    Yes, getbalance now returns with the same speed as 0.8.6. So I'd consider this issue solved.

  13. laanwj added the label Wallet on May 9, 2014
  14. laanwj closed this on May 9, 2014

  15. 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-15 15:15 UTC

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