diff options
| author | Wladimir J. van der Laan <[email protected]> | 2018-02-08 08:40:55 +0100 |
|---|---|---|
| committer | Wladimir J. van der Laan <[email protected]> | 2018-02-08 08:41:18 +0100 |
| commit | 7217ea2cc8dd17784a95574724e76303ac2e2823 (patch) | |
| tree | 0436ac31a688ecb1b59660a5e02abc1473bd06b6 /src/init.cpp | |
| parent | Merge #10498: Use static_cast instead of C-style casts for non-fundamental types (diff) | |
| parent | Fix fast-shutdown crash if genesis block was not loaded (diff) | |
| download | discoin-7217ea2cc8dd17784a95574724e76303ac2e2823.tar.xz discoin-7217ea2cc8dd17784a95574724e76303ac2e2823.zip | |
Merge #12367: Fix two fast-shutdown bugs
dd2de47 Fix fast-shutdown crash if genesis block was not loaded (Matt Corallo)
1c9394a Fix fast-shutdown hang on ThreadImport+GenesisWait (Matt Corallo)
Pull request description:
The second commit is a much simpler alternative fix for the issue fixed in #12349. To test I made ShutdownRequested() always StartShutdown() after a certain number of calls, which turned up one other hang, fixed in the first commit.
Tree-SHA512: 86bde6ac4b8b4e2cb99fff87dafeed02c0d9514acee6d94455637fb2da9ffc274b5ad31b0a6b9f5bd7b700ae35395f28ddb14ffc65ddda3619aa28df28a5607d
Diffstat (limited to 'src/init.cpp')
| -rw-r--r-- | src/init.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/init.cpp b/src/init.cpp index 50643ff96..14dd8fc8a 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -1645,12 +1645,19 @@ bool AppInitMain() // Wait for genesis block to be processed { WaitableLock lock(cs_GenesisWait); - while (!fHaveGenesis) { - condvar_GenesisWait.wait(lock); + // We previously could hang here if StartShutdown() is called prior to + // ThreadImport getting started, so instead we just wait on a timer to + // check ShutdownRequested() regularly. + while (!fHaveGenesis && !ShutdownRequested()) { + condvar_GenesisWait.wait_for(lock, std::chrono::milliseconds(500)); } uiInterface.NotifyBlockTip.disconnect(BlockNotifyGenesisWait); } + if (ShutdownRequested()) { + return false; + } + // ********************************************************* Step 11: start node int chain_active_height; |