bug: Reindex started via ThreadSafeQuestion will always fail #22964

issue dongcarl openend this issue on September 13, 2021
  1. dongcarl commented at 8:24 pm on September 13, 2021: member

    When our chainstate activation sequence fails and we’re running the GUI, we ask the user via a question box whether or not they’d like to re-run the sequence with fReindex = true. Fun fact: despite the fact that this sequence is wrapped in a while loop, we only run it twice at most.

    https://github.com/bitcoin/bitcoin/blob/7ecb309c4ed1bb9ae6b9a12cbb4f083328edc125/src/init.cpp#L1539-L1556

    If they answer yes, the sequence will always fail, because a chainstate will have already been initialized in the original run and InitializeChainstate will throw a std::logic_error:

    https://github.com/bitcoin/bitcoin/blob/7ecb309c4ed1bb9ae6b9a12cbb4f083328edc125/src/validation.cpp#L4573-L4594

    This always reproduces. To reproduce:

    0gdb ./src/qt/bitcoin-qt
    1(gdb) b InitializeChainstate
    2(gdb) # add breakpoint for the "if (!fLoaded && !ShutdownRequested()) {" line
    3(gdb) r  # should stop at the breakpoint for InitializeChainstate
    4(gdb) c  # to advance to the breakpoint for the "if (!fLoaded && !ShutdownRequested()) {" line
    5(gdb) set fLoaded=false
    6(gdb) c  # should stop at the breakpoint for InitializeChainstate
    7(gdb) n  # step through InitializeChainstate to see that it throws
    

    We expect the re-run of the chainstate activation sequence to not always fail.

  2. dongcarl added the label Bug on Sep 13, 2021
  3. dongcarl referenced this in commit 0143c9e280 on Sep 13, 2021
  4. dongcarl referenced this in commit 3de7842f50 on Sep 14, 2021
  5. dongcarl referenced this in commit 6c412375d1 on Oct 7, 2021
  6. dongcarl referenced this in commit e05541e7cd on Oct 7, 2021
  7. dongcarl referenced this in commit a8a5ea8415 on Oct 8, 2021
  8. dongcarl referenced this in commit 9677780f38 on Oct 9, 2021
  9. jamesob commented at 2:48 pm on January 3, 2022: member
    @dongcarl is this still an issue, or was it resolved by the merge of #23280?
  10. dongcarl referenced this in commit 2db8805985 on Jan 7, 2022
  11. dongcarl referenced this in commit c926196765 on Jan 7, 2022
  12. ajtowns referenced this in commit 48ae4c1217 on Jan 10, 2022
  13. MarcoFalke commented at 10:27 am on January 28, 2022: member

    Might be good to look into how we can remove the most code while fixing this bug. Usually the bugfixes that remove the most code are the cleanest.

    We could then fix #20030, #24145 and #19909 in one swipe.

  14. dongcarl referenced this in commit 4924ad3730 on Feb 23, 2022
  15. dongcarl referenced this in commit 6b3a330fd8 on Feb 23, 2022
  16. dongcarl referenced this in commit aea32e50f5 on Mar 7, 2022
  17. dongcarl referenced this in commit 1bde56bc0e on Mar 9, 2022
  18. dongcarl referenced this in commit 28ead106fe on Mar 9, 2022
  19. dongcarl referenced this in commit 81bf068b02 on Mar 9, 2022
  20. dongcarl referenced this in commit b7e44255af on Mar 17, 2022
  21. dongcarl referenced this in commit 276a07f929 on Mar 18, 2022
  22. dongcarl referenced this in commit 011980a9fa on Apr 12, 2022
  23. dongcarl referenced this in commit f8afc08153 on Apr 12, 2022
  24. dongcarl referenced this in commit 727fdbf6ed on Apr 18, 2022
  25. dongcarl referenced this in commit 24b2048d62 on Apr 18, 2022
  26. dongcarl referenced this in commit 6b5816ebc4 on Apr 18, 2022
  27. dongcarl referenced this in commit d04d3c4c1f on Apr 20, 2022
  28. dongcarl referenced this in commit 976679b251 on Apr 25, 2022
  29. dongcarl referenced this in commit 09574d7ad7 on Apr 26, 2022
  30. dongcarl referenced this in commit 5921b863e3 on Apr 27, 2022
  31. MarcoFalke closed this on Apr 28, 2022

  32. MarcoFalke referenced this in commit b51e60f914 on Apr 28, 2022
  33. janus referenced this in commit c0680c896e on Aug 4, 2022
  34. Fabcien referenced this in commit 8ddcf128ce on Feb 2, 2023
  35. DrahtBot locked this on Apr 28, 2023

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-07-05 19:13 UTC

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