bitcoin-core / gui

Bitcoin Core GUI staging repository

Home Page:https://github.com/bitcoin/bitcoin

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Segfault in qt/clientmodel.cpp:92 on every shutdown

maflcko opened this issue · comments

Is there an existing issue for this?

  • I have searched the existing issues

Current behaviour

On shutdown, I get a crash in return m_node.getNodeCount(connections);

Expected behaviour

No crash

Steps to reproduce

  • Shutdown Bitcoin Core

Relevant log output

No response

How did you obtain Bitcoin Core

Compiled from source

What version of Bitcoin Core are you using?

master

Operating system and version

ubuntu

Machine specifications

No response

The thread b-msghand is still busy in ActivateBestChainStep, the thread b-shutoff is currently joining the message handler thread in CConnman::StopThreads net.cpp:3336.

The thread bitcoin-qt is the one segfaulting.

Steps to reproduce:

diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp
index ad80922c8b..d6ca01ebc4 100644
--- a/src/qt/bitcoingui.cpp
+++ b/src/qt/bitcoingui.cpp
@@ -989,6 +989,7 @@ void BitcoinGUI::gotoLoadPSBT(bool from_clipboard)
 
 void BitcoinGUI::updateNetworkState()
 {
+UninterruptibleSleep(100ms);
     int count = clientModel->getNumConnections();
     QString icon;
     switch(count)
diff --git a/src/validation.cpp b/src/validation.cpp
index 81a3c35864..c18608dcd7 100644
--- a/src/validation.cpp
+++ b/src/validation.cpp
@@ -3140,6 +3140,7 @@ bool Chainstate::ActivateBestChainStep(BlockValidationState& state, CBlockIndex*
 
         // Connect new blocks.
         for (CBlockIndex* pindexConnect : reverse_iterate(vpindexToConnect)) {
+        UninterruptibleSleep(3s);
             if (!ConnectTip(state, pindexConnect, pindexConnect == pindexMostWork ? pblock : std::shared_ptr<const CBlock>(), connectTrace, disconnectpool)) {
                 if (state.IsInvalid()) {
                     // The block violates a consensus rule.
gdb --args ./src/qt/bitcoin-qt -signet -datadir=/run/media/marco/scratch_fde/signet/ -printtoconsole  -server
...
run
while ./src/bitcoin-cli -signet -datadir=/run/media/marco/scratch_fde/signet/ setnetworkactive true && sleep 0.2 && ./src/bitcoin-cli -signet -datadir=/run/media/marco/scratch_fde/signet/ setnetworkactive false ; do true ; done
  • Exit the GUI via the [x] button

#801

@maflcko Does it fix the issue for you?

Closed by #801.