Shutdown ordering bug (SIGABRT) #788

Closed
opened 2026-07-16 12:21:35 +00:00 by johnny9 · 0 comments
johnny9 commented 2026-07-16 12:21:35 +00:00 (Migrated from github.com)

Looking at this crash report, the picture is pretty clear once you follow the crashing thread and cross-reference it against what the other threads were doing at the same instant.

What's actually happening

Thread 0 (main thread) is in the middle of shutting down the app. The crash stack is:

QmlGuiMain(...) 
  → BitcoinQtInit::~BitcoinQtInit()
    → node::NodeContext::~NodeContext()
      → std::terminate() → abort()

abort() here isn't a segfault — it's std::terminate() being invoked, which in C++ almost always means an exception escaped somewhere it wasn't allowed to (e.g., thrown out of a destructor, thrown during stack unwinding while another exception is already in flight, or thrown across a noexcept boundary). So something inside NodeContext's teardown threw, and the runtime had no way to handle it.

Notes from claude...

Why it's throwing: a shutdown race

The real smoking gun is what the other threads were doing at the exact moment NodeContext started destructing:

  • b-msghand was mid-flight inside ChainstateManager::ProcessNewBlock → ConnectBlock → UpdateCoins → CCoinsViewCache::SpendCoin — i.e., actively mutating chainstate.
  • b-scriptch.00–b-scriptch.08 (9 script-check worker threads) were actively running secp256k1_ecdsa_verify — live signature verification work, not idle.
  • b-net, b-scheduler, b-torcontrol, b-mapport, b-http.* were all still alive and running their loops.

None of these threads show an interrupt/shutdown/join sequence in their stacks — they look like they were simply still running normal steady-state work. Meanwhile the main thread had already started tearing down NodeContext, which those threads depend on (chainstate, coins cache, check queue, etc.).

That's a classic shutdown-ordering bug: the destructor path is destroying shared node state before all worker threads have been signaled to stop and joined. A worker thread touching a partially-destroyed object (or an internal assertion catching the inconsistency and throwing/aborting) is exactly the kind of thing that surfaces as "exception during unwind → std::terminate."

Context that supports this

  • The bundle ID is org.bitcoincore.gui-qml.preview — this is Bitcoin Core's newer QML-based GUI, which is understood to still be an early/preview build (as opposed to the long-stable Qt Widgets GUI). Early-access shutdown-path bugs like this are plausible in that codebase.
  • The crash happened ~2.5 minutes after launch (procLaunch 09:13:47 vs. crash 09:16:18) — consistent with the app still being in initial block/header sync when you quit it, which is exactly when script-check and message-handler threads are busiest.

Practical takeaways

  • This is very likely reproducible by quitting the app while it's actively validating blocks (e.g., during IBD or right after receiving a new block), since that's the state captured in the log.
  • Not something you can fix from the outside — it's an application-level bug in the shutdown sequence of this preview build.
  • Worth reporting upstream (Bitcoin Core's GitHub issue tracker) with this crash log attached, specifically noting the concurrent ConnectBlock/secp256k1_ecdsa_verify activity on other threads at time of crash — that detail is the useful diagnostic signal for whoever fixes it.
  • If it's disruptive, avoid quitting the app while sync is actively running (e.g., wait for it to be idle/synced) until a build with the fix is available.

bitcoin-qml-crash-report.txt

Looking at this crash report, the picture is pretty clear once you follow the crashing thread and cross-reference it against what the other threads were doing at the same instant. ## What's actually happening **Thread 0 (main thread) is in the middle of shutting down the app.** The crash stack is: ``` QmlGuiMain(...) → BitcoinQtInit::~BitcoinQtInit() → node::NodeContext::~NodeContext() → std::terminate() → abort() ``` `abort()` here isn't a segfault — it's `std::terminate()` being invoked, which in C++ almost always means an exception escaped somewhere it wasn't allowed to (e.g., thrown out of a destructor, thrown during stack unwinding while another exception is already in flight, or thrown across a `noexcept` boundary). So something inside `NodeContext`'s teardown threw, and the runtime had no way to handle it. Notes from claude... ## Why it's throwing: a shutdown race The real smoking gun is what the **other threads** were doing at the exact moment `NodeContext` started destructing: - **`b-msghand`** was mid-flight inside `ChainstateManager::ProcessNewBlock` → `ConnectBlock` → `UpdateCoins` → `CCoinsViewCache::SpendCoin` — i.e., actively mutating chainstate. - **`b-scriptch.00`–`b-scriptch.08`** (9 script-check worker threads) were actively running `secp256k1_ecdsa_verify` — live signature verification work, not idle. - **`b-net`**, **`b-scheduler`**, **`b-torcontrol`**, **`b-mapport`**, **`b-http.*`** were all still alive and running their loops. None of these threads show an interrupt/shutdown/join sequence in their stacks — they look like they were simply still running normal steady-state work. Meanwhile the main thread had already started tearing down `NodeContext`, which those threads depend on (chainstate, coins cache, check queue, etc.). That's a classic **shutdown-ordering bug**: the destructor path is destroying shared node state before all worker threads have been signaled to stop and joined. A worker thread touching a partially-destroyed object (or an internal assertion catching the inconsistency and throwing/aborting) is exactly the kind of thing that surfaces as "exception during unwind → `std::terminate`." ## Context that supports this - The bundle ID is `org.bitcoincore.gui-qml.preview` — this is Bitcoin Core's newer QML-based GUI, which is understood to still be an early/preview build (as opposed to the long-stable Qt Widgets GUI). Early-access shutdown-path bugs like this are plausible in that codebase. - The crash happened ~2.5 minutes after launch (`procLaunch` 09:13:47 vs. crash 09:16:18) — consistent with the app still being in initial block/header sync when you quit it, which is exactly when script-check and message-handler threads are busiest. ## Practical takeaways - This is very likely reproducible by quitting the app while it's actively validating blocks (e.g., during IBD or right after receiving a new block), since that's the state captured in the log. - Not something you can fix from the outside — it's an application-level bug in the shutdown sequence of this preview build. - Worth reporting upstream (Bitcoin Core's GitHub issue tracker) with this crash log attached, specifically noting the concurrent `ConnectBlock`/`secp256k1_ecdsa_verify` activity on other threads at time of crash — that detail is the useful diagnostic signal for whoever fixes it. - If it's disruptive, avoid quitting the app while sync is actively running (e.g., wait for it to be idle/synced) until a build with the fix is available. [bitcoin-qml-crash-report.txt](https://github.com/user-attachments/files/30087649/bitcoin-qml-crash-report.txt)
Sign in to join this conversation.
No description provided.