Windows client can’t handle sudden shutdown or system reboot #5610

issue mgrigajtis openend this issue on January 6, 2015
  1. mgrigajtis commented at 11:04 pm on January 6, 2015: none
    If client is running in Windows and system experiences a hard reboot or shutdown, the entire block chain needs to be re-downloaded next time application is launched.
  2. laanwj commented at 11:04 am on January 7, 2015: member

    That has nothing to do with windows. Switching off the computer at unexpected times can result in disk corruption at the hardware, OS or application level. It is possible to build in some robustness to this, e.g. by writing in log-like format and limiting the amount of write buffering, but in the general case something can go awfully wrong and require a rebuild. This is why important computing equipment is protected by UPSes and such.

    One correction though: you don’t generally need to re-download the blockchain. Using -reindex to rebuild the block and utxo databases should be enough.

  3. laanwj closed this on Jan 7, 2015

  4. laanwj reopened this on Jan 8, 2015

  5. laanwj commented at 8:46 am on January 8, 2015: member

    Reopening this as it could be a real issue.

    What version of Bitcoin Core are you using? Was this during the initial sync or was the node synchronized?

  6. laanwj commented at 11:22 am on January 8, 2015: member
  7. laanwj added the label Windows on Jan 8, 2015
  8. mgrigajtis commented at 10:53 pm on January 8, 2015: none
    I’m using 0.10.0rc1 for Windows 7 (64 bit system).
  9. gmaxwell commented at 1:38 pm on January 9, 2015: contributor
    To clarify “real issue” from my perspective; especially on random consumer software/hardware we cannot reasonably expect that it will never become corrupted on an unclean power off; because there has been quite a bit of broken stuff out there that scribbled randomly on the disk in the case. But at the very least it should be rare. If it isn’t rare it may indicate another problem.
  10. wtogami commented at 3:02 pm on January 23, 2015: contributor
    I was surprised to find write-ahead caching to be enabled by default on Windows 8.1 on an ordinary office computer. I’m guessing that would increase the chances of lots of data loss from a system crash or unexpected power off.
  11. veqtrus commented at 7:46 pm on June 14, 2015: contributor

    I’m running 0.10.2 and it is the chainstate that gets corrupted. That was also the case with 0.10.x but not with 0.9.x. Log:

     02015-06-14 19:12:17 GUI: "registerShutdownBlockReason: Successfully registered: Bitcoin Core didn't yet exit safely..." 
     12015-06-14 19:12:18 
     2
     3...
     4
     52015-06-14 19:12:29 init message: Loading block index...
     62015-06-14 19:12:30 Opening LevelDB in C:\Users\Administrator\AppData\Roaming\Bitcoin\blocks\index
     72015-06-14 19:12:35 Opened LevelDB successfully
     82015-06-14 19:12:35 Opening LevelDB in C:\Users\Administrator\AppData\Roaming\Bitcoin\chainstate
     92015-06-14 19:13:05 Corruption: error in middle of record
    102015-06-14 19:13:14 init message: Loading block index...
    112015-06-14 19:13:14 Wiping LevelDB in C:\Users\Administrator\AppData\Roaming\Bitcoin\blocks\index
    122015-06-14 19:13:15 Opening LevelDB in C:\Users\Administrator\AppData\Roaming\Bitcoin\blocks\index
    132015-06-14 19:13:15 Opened LevelDB successfully
    142015-06-14 19:13:15 Wiping LevelDB in C:\Users\Administrator\AppData\Roaming\Bitcoin\chainstate
    152015-06-14 19:13:20 Opening LevelDB in C:\Users\Administrator\AppData\Roaming\Bitcoin\chainstate
    162015-06-14 19:13:20 Opened LevelDB successfully
    172015-06-14 19:13:21 Initializing databases...
    

    Since multiple files are used for the DB shouldn’t only the latest be rebuilt?

  12. Diapolo commented at 5:39 am on June 15, 2015: none
    Are you talking about bitcoind.exe or bitcoin-qt.exe? The GUI version takes a countermeasure, if you are doing a “normal” shutdown while the client is running, it prevents shutdown until the client has exited (WinShutdownMonitor).
  13. luke-jr commented at 5:55 am on June 15, 2015: member
    FWIW, since switching from 0.8 to 0.10, any unclean shutdown at the hardware level (ie, more than kill -9) has resulted in a corrupt index needing rebuild… on Linux.
  14. veqtrus commented at 11:51 pm on June 15, 2015: contributor
    bitcoin-qt.exe and this happened due to power loss.
  15. PRabahy commented at 6:27 pm on July 6, 2015: contributor

    Running 0.11rc2 on Windows 7 64bit. Had a power loss.

    2015-07-06 18:21:14 * Using 2.0MiB for block index database 2015-07-06 18:21:14 * Using 32.5MiB for chain state database 2015-07-06 18:21:14 * Using 65.5MiB for in-memory UTXO set 2015-07-06 18:21:14 init message: Loading block index… 2015-07-06 18:21:14 Opening LevelDB in C:\Users\PRabahy\AppData\Roaming\Bitcoin\blocks\index 2015-07-06 18:21:15 Opened LevelDB successfully 2015-07-06 18:21:15 Opening LevelDB in C:\Users\PRabahy\AppData\Roaming\Bitcoin\chainstate 2015-07-06 18:21:15 Corruption: error in middle of record

  16. laanwj commented at 6:32 pm on July 6, 2015: member

    This happens while reading the log:

    0src/leveldb/db/log_reader.cc:          ReportCorruption(scratch->size(), "error in middle of record");
    

    Could this be the leveldb short writes issue again? We’ve recently enabled paranoid checks (#4177), which shouldn’t trigger in case of incomplete writes in case of leveldb 1.15+, but maybe there is something else too where paranoid checks are too paranoid. @luke-jr what error do you see on LInux?

  17. laanwj added the label Priority High on Oct 21, 2015
  18. Diapolo commented at 8:28 pm on October 21, 2015: none
    Could it be that LevelDBs development is dead? https://github.com/google/leveldb
  19. laanwj added the label Data corruption on Feb 9, 2016
  20. laanwj removed the label Priority High on Oct 9, 2016
  21. fanquake commented at 9:48 am on October 10, 2016: member
    Closing this in favour of #7233, which has more extensive & recent discussion.
  22. fanquake closed this on Oct 10, 2016

  23. 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: 2024-12-30 15:12 UTC

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