std::bad_alloc crashes while processing blocks #5596

issue patrikr opened this issue on January 4, 2015
  1. patrikr commented at 3:16 AM on January 4, 2015: none

    Bitcoin Core v 0.10.0rc1 OS: Windows XP (32 bit) Memory: 2 GB

    While catching up with the blockchain, I get this crash every few hours:

    bc_crash1

    debug.log:

    2015-01-03 23:59:09 UpdateTip: new best=0000000000000000096d8fc77a645408571f25104d2b596041c5c2a037038e6f  height=334892  log2_work=81.779496  tx=54399674  date=2014-12-19 00:22:26 progress=0.963288  cache=170409
    2015-01-03 23:59:32 
    
    ************************
    EXCEPTION: St9bad_alloc       
    std::bad_alloc       
    D:\programs\bitcoin-0.10.0rc1\bitcoin-qt.exe in ProcessMessages()       
    
    2015-01-03 23:59:32 ProcessMessage(block, 999803 bytes) FAILED peer=16
    

    I've noticed that this occurs when the "cache=" part of the "UpdateTip" lines is about to go from 170k+ back to zero. When I restart it then starts over from the last block where cache=0, which means I lose about half an hour of work. (The time it takes this computer to go from cache=0 to cache=170000.)

  2. sipa commented at 5:10 AM on January 4, 2015: member

    How much is your dbcache set to? This looks like out-of-memory...

  3. patrikr commented at 5:22 AM on January 4, 2015: none

    I have not changed the dbcache, AFAIK, so it should have the default value.

  4. patrikr commented at 8:47 AM on January 6, 2015: none

    I tried dbcache=50, and that helped: I was able to sync the last 2 weeks of the blockchain without crashes.

  5. laanwj closed this on Jan 8, 2015

  6. patrikr commented at 11:54 PM on January 8, 2015: none

    Closed? Is the bug fixed?

  7. laanwj commented at 9:04 AM on January 9, 2015: member

    Running out of memory is not a bug, and you managed to work around it with a lower dbcache.

  8. patrikr commented at 4:47 PM on January 9, 2015: none

    Running out of memory is not a bug, but crashing and losing a lot of work when you run out of memory, that is a bug.

  9. laanwj commented at 9:36 AM on January 10, 2015: member

    Continuous work is underway to e.g. reduce bitcoind's memory footprint. But that doesn't warrant keeping open this issue.

    As for losing work, syncing to disk only once per hour (or once the cache is full) is a conscious choice for performance. If you want more frequent flushes, you can reduce the dbsize, which you did. Hey at least it picks up again and it doesn't have to start over from scratch.

  10. MarcoFalke locked this on Sep 8, 2021
Contributors

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-29 03:16 UTC

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