HomePhabricator

Merge #12349: shutdown: fix crash on shutdown with reindex-chainstate

Description

Merge #12349: shutdown: fix crash on shutdown with reindex-chainstate

Summary:
ceaefdd fix possible shutdown assertion with -reindex-shutdown (Cory Fields)

Pull request description:

Fixes the assertion error reported here: https://github.com/bitcoin/bitcoin/pull/12349#issuecomment-365095741

Tree-SHA512: db8e2a275f92a99df7f17852d00eba6df996e412aa3ed3853a9ea0a8cb9800760677532efd52f92abbf2cdcc4210957a87a5f919ac998d46c205365a7a7dffca

Backport of Core PR 12349
https://github.com/bitcoin/bitcoin/pull/12349/files
Discovered while working on PR 12367 (D2906)
Depends on D2906

Test Plan:
make check

On master, apply this patch:

diff --git a/src/init.cpp b/src/init.cpp
index 56520fe..8d7371d 100644
--- a/src/init.cpp
+++ b/src/init.cpp
@@ -2139,6 +2139,7 @@ bool AppInitMain(Config &config,
                         break;
                     }
                 }
+                fRequestShutdown = true;

                 if (!fReindex && !fReindexChainState) {
                     uiInterface.InitMessage(_("Verifying blocks..."));

Then run:
gdb --args ./src/bitcoind -connect=0 -testnet -reindex-chainstate
A crash should be encountered.

Apply the same patch above on this diff and run the same command above.
GDB should report a successful program exit.

Reviewers: deadalnix, Fabien, #bitcoin_abc

Reviewed By: Fabien, #bitcoin_abc

Differential Revision: https://reviews.bitcoinabc.org/D2907

Details

Provenance
Wladimir J. van der Laan <laanwj@gmail.com>Authored on Feb 15 2018, 21:21
jasonbcoxCommitted on May 6 2019, 16:15
jasonbcoxPushed on May 6 2019, 19:32
Reviewer
Restricted Project
Differential Revision
D2907: Merge #12349: shutdown: fix crash on shutdown with reindex-chainstate
Parents
rSTAGINGbb92536992e0: Merge #12367: Fix two fast-shutdown bugs
Branches
Unknown
Tags
Unknown