Quitting or unloading a wallet while an Activity list is still applying a wallet change crashes the app with SIGSEGV #1116

Open
opened 2026-11-11 08:26:24 +00:00 by jarolrod · 2 comments
jarolrod commented 2026-11-11 08:26:24 +00:00 (Migrated from github.com)

If the app is asked to quit while an open wallet's Activity list has a transaction change it has not laid out yet, and that list is not the page on screen, it dies with a segmentation fault and the node skips its clean shutdown. On a large wallet, in a window that is being drawn, that state lasts several seconds. The same crash is reached without a quit when a wallet in that state is unloaded; the details are in this comment.

To reproduce:

  1. Open a wallet with about 5,000 transactions and leave its Receive tab showing.
  2. Receive a payment, or mine a block that confirms one. The window is unresponsive for about 4.5 s.
  3. Ask the app to quit within that time.

The process exits with SIGSEGV. debug.log has no Shutdown done and stderr is empty.

With that wallet's Activity tab showing, the quit is clean. The list on screen is spared; the list that crashes is one that is not on screen. That can also be the list of a second open wallet: in the rows below without "one wallet", two wallets were open, the payment went from one to the other and blocks were mined to the sender, with the recipient's Activity showing. The sender's list is the one that crashed.

Case, current qt6 Crashes
Request payment, quit 2 s later, offscreen / native 7 of 7 / 7 of 7
Ordinary payment, quit 2 s later, offscreen / native 5 of 5 / 5 of 5
Confirming block, quit 2 s later 7 of 7
Quit 0.3 s, 1 s, 4 s after the payment 5 of 5, 5 of 5, 4 of 5
Quit 5 s, 6 s, 14 s after the payment 0 of 5 each
Nothing changed in the wallet 0 of 5
One wallet, payment from outside the app, Receive showing, quit 2 s later 6 of 6
One wallet, payment from outside the app, Activity showing, quit 2 s later 0 of 6
Two wallets, only the wallet on screen changes, Activity showing, quit 2 s later 0 of 3
Receive or Send page showing, quit 2 s later 5 of 5 each
30-transaction wallet, quit at once / 0.1 s later / 2 s later 13 of 13 / 0 of 5 / 0 of 5

Every quit route behaved the same, 5 of 5 each offscreen and native: the application quit event, closing the window, RPC stop, and SIGTERM. The same matrix on 6e54a48ab571 gave the same pattern.

Crash reports show the main thread in:

QQuickListViewPrivate::setSectionHelper
QQuickListViewPrivate::getSectionItem
QQuickListViewPrivate::updateInlineSection
QQuickListViewPrivate::updateSections
QQuickItemViewPrivate::applyModelChanges
QQuickItemViewPrivate::layout
...
QQuickStackElement::~QQuickStackElement
QQuickStackView::~QQuickStackView

That is EXC_BAD_ACCESS at address 0x8, reached from the deferred delete of a page.

On shutdown the main window clears its page stack (MainWindow.qml#L310-L313). The Activity list uses section delegates (ActivityListPage.qml#L346-L348). When the stack is destroyed while a list that is not on screen still has a model change to lay out, Qt updates its sections against a context that is already gone. I inferred the link to main.clear() from the trace; I did not confirm it with a debugger. The same frames appear in KDE bug 500579 on Qt 6.8.2, so the weakness is in Qt, and the app can avoid triggering it.

After a crash the app restarted normally: wallets, the saved request and the payment were intact. mempool.dat had not been written. When the crash followed a confirming block, the node came back one block lower, as it also did after a SIGKILL control. I did not measure the cost of that on a long-running node.

#990 at 389e2f1dac5c shortens the freeze to 0.3 to 0.6 s, and a quit 2 s after a payment on the 5,000-transaction wallet was clean there, 0 of 5 against 3 of 3 on its base, offscreen. It does not change the crash where the window is not drawn: minimized, a quit crashed 10 of 10 and an unload 15 of 15, as on the base, and a quit within 5 ms of a payment crashed 14 of 34. The numbers are in my comment there. The freeze itself is the label scan in #974.

Suggested: stop a wallet's views from applying model changes before they are destroyed, for example by detaching the list's model or section delegate before the page stack is cleared at shutdown and before a wallet's view is dropped on unload. Keeping the stack alive until node shutdown has finished would cover the quit only.

Reproduced on merged qt6 at eed1f426fcb6 and at 6e54a48ab571, macOS arm64 / Qt 6.9.0, isolated regtest, offscreen and native. Payments and blocks came over RPC; except in the one-wallet rows, the paying wallet was open in the same app. The quit event and window close were sent through the test bridge; no physical Cmd+Q or menu click was used. macOS wrote crash reports for 8 of 214 crashes, all with the same frames; the other cells rest on exit code -11 and the same last log line.

If the app is asked to quit while an open wallet's Activity list has a transaction change it has not laid out yet, and that list is not the page on screen, it dies with a segmentation fault and the node skips its clean shutdown. On a large wallet, in a window that is being drawn, that state lasts several seconds. The same crash is reached without a quit when a wallet in that state is unloaded; the details are in [this comment](https://github.com/bitcoin-core/gui-qml/issues/1116#issuecomment-6860740988). To reproduce: 1. Open a wallet with about 5,000 transactions and leave its **Receive** tab showing. 2. Receive a payment, or mine a block that confirms one. The window is unresponsive for about 4.5 s. 3. Ask the app to quit within that time. The process exits with SIGSEGV. `debug.log` has no `Shutdown done` and stderr is empty. With that wallet's **Activity** tab showing, the quit is clean. The list on screen is spared; the list that crashes is one that is not on screen. That can also be the list of a second open wallet: in the rows below without "one wallet", two wallets were open, the payment went from one to the other and blocks were mined to the sender, with the recipient's **Activity** showing. The sender's list is the one that crashed. | Case, current `qt6` | Crashes | |---|---| | Request payment, quit 2 s later, offscreen / native | 7 of 7 / 7 of 7 | | Ordinary payment, quit 2 s later, offscreen / native | 5 of 5 / 5 of 5 | | Confirming block, quit 2 s later | 7 of 7 | | Quit 0.3 s, 1 s, 4 s after the payment | 5 of 5, 5 of 5, 4 of 5 | | Quit 5 s, 6 s, 14 s after the payment | 0 of 5 each | | Nothing changed in the wallet | 0 of 5 | | One wallet, payment from outside the app, **Receive** showing, quit 2 s later | 6 of 6 | | One wallet, payment from outside the app, **Activity** showing, quit 2 s later | 0 of 6 | | Two wallets, only the wallet on screen changes, **Activity** showing, quit 2 s later | 0 of 3 | | Receive or Send page showing, quit 2 s later | 5 of 5 each | | 30-transaction wallet, quit at once / 0.1 s later / 2 s later | 13 of 13 / 0 of 5 / 0 of 5 | Every quit route behaved the same, 5 of 5 each offscreen and native: the application quit event, closing the window, RPC `stop`, and SIGTERM. The same matrix on `6e54a48ab571` gave the same pattern. Crash reports show the main thread in: ``` QQuickListViewPrivate::setSectionHelper QQuickListViewPrivate::getSectionItem QQuickListViewPrivate::updateInlineSection QQuickListViewPrivate::updateSections QQuickItemViewPrivate::applyModelChanges QQuickItemViewPrivate::layout ... QQuickStackElement::~QQuickStackElement QQuickStackView::~QQuickStackView ``` That is `EXC_BAD_ACCESS` at address 0x8, reached from the deferred delete of a page. On shutdown the main window clears its page stack ([MainWindow.qml#L310-L313](https://github.com/bitcoin-core/gui-qml/blob/eed1f426fcb64daa61b004590335a03afe376274/qml/pages/MainWindow.qml#L310-L313)). The Activity list uses section delegates ([ActivityListPage.qml#L346-L348](https://github.com/bitcoin-core/gui-qml/blob/eed1f426fcb64daa61b004590335a03afe376274/qml/pages/wallet/ActivityListPage.qml#L346-L348)). When the stack is destroyed while a list that is not on screen still has a model change to lay out, Qt updates its sections against a context that is already gone. I inferred the link to `main.clear()` from the trace; I did not confirm it with a debugger. The same frames appear in [KDE bug 500579](https://bugs.kde.org/show_bug.cgi?id=500579) on Qt 6.8.2, so the weakness is in Qt, and the app can avoid triggering it. After a crash the app restarted normally: wallets, the saved request and the payment were intact. `mempool.dat` had not been written. When the crash followed a confirming block, the node came back one block lower, as it also did after a SIGKILL control. I did not measure the cost of that on a long-running node. #990 at `389e2f1dac5c` shortens the freeze to 0.3 to 0.6 s, and a quit 2 s after a payment on the 5,000-transaction wallet was clean there, 0 of 5 against 3 of 3 on its base, offscreen. It does not change the crash where the window is not drawn: minimized, a quit crashed 10 of 10 and an unload 15 of 15, as on the base, and a quit within 5 ms of a payment crashed 14 of 34. The numbers are in [my comment there](https://github.com/bitcoin-core/gui-qml/pull/990#issuecomment-6864222454). The freeze itself is the label scan in #974. Suggested: stop a wallet's views from applying model changes before they are destroyed, for example by detaching the list's model or section delegate before the page stack is cleared at shutdown and before a wallet's view is dropped on unload. Keeping the stack alive until node shutdown has finished would cover the quit only. Reproduced on merged `qt6` at `eed1f426fcb6` and at `6e54a48ab571`, macOS arm64 / Qt 6.9.0, isolated regtest, offscreen and native. Payments and blocks came over RPC; except in the one-wallet rows, the paying wallet was open in the same app. The quit event and window close were sent through the test bridge; no physical Cmd+Q or menu click was used. macOS wrote crash reports for 8 of 214 crashes, all with the same frames; the other cells rest on exit code -11 and the same last log line.
jarolrod commented 2026-11-13 14:41:58 +00:00 (Migrated from github.com)

This has no time limit while the window is not being drawn, and a small wallet is enough.

A window that is minimized, hidden or completely covered by another window lays nothing out, so a change that arrives then stays pending until the window is shown again. A quit in that state crashes if the changed wallet's Activity list is not the page on screen.

At 2bd5a61e8304, native window, 30-transaction wallet, payment sent from outside the app so that exactly one open wallet changes, window minimized or hidden first, quit 10 to 30 s later:

Case Crashes
One wallet, app left on its start page 8 of 8
One wallet, Receive / block clock / Settings showing 5 of 5 / 11 of 11 / 5 of 5
One wallet, Activity showing 0 of 17
Two wallets, the change in a wallet that is not selected or not on its Activity tab 109 of 109
Two wallets, the change only in the selected wallet, Activity showing 0 of 38
Nothing changed in the wallet 0 of 14

With a payment between two open wallets it was 101 of 101, with waits from 5 s to 600 s before the quit.

Without minimizing, Receive showing, quit 15 s after the payment:

Case Crashes
Window in front when the payment arrived 0 of 16
Window completely covered by another window, change not laid out at the quit 5 of 5

So a node started with one wallet and left on its start page, then minimized, hidden or left completely covered by other windows, crashes on quit once a payment or a confirmation has arrived, unless its window is brought forward first. Nothing in the wallet has to be opened. One frame is enough to clear the state: in the one covered launch where the window was exposed for a moment before the quit, the quit was clean.

One case where a crash did cost something: a legacy wallet update in progress. With a second open wallet in the crashing state, Quit during Update wallet crashed 7 of 7, before the node was told to shut down, so the update was neither finished nor rolled back. The wallet was left half-converted: it would not open, a second update was refused as "already a descriptor wallet", and the backup could not be imported (#629). Copying the .legacy.bak over wallet.dat by hand restored it. Without the crashing state the same quit was clean, 6 of 6, and the original wallet was restored. That roll back is what Core does when the wallet is behind the chain tip; a wallet at the tip keeps the finished update after a clean quit (3 of 3 each way, offscreen, with a 15,000-key wallet written by Bitcoin Core 29.0). The crash runs used a hand-built 60,001-key legacy wallet, whose update lasted tens of seconds. With the 29.0 wallet I repeated only the kill, with bitcoind alone: it leaves the same half-converted state, 6 of 6.

The application quit event and SIGTERM behaved the same. Each crash exits with SIGSEGV and debug.log has no Shutdown done. eed1f426fcb6 gave the same split, 8 of 8 against 0 of 5.

Limits:

  • Minimize, hide and raise were the window's own showMinimized(), hide() and raise() calls made through the test bridge, and the cover was a second app window. I did not use the yellow button, Cmd+M, the Dock or the tray menu, no physical Cmd+Q, and nothing was checked on a screen.
  • I did not read a crash report for these cases. The link to the trace above rests on the same exit signal, the same last log line and the same controls.
  • I do not know why the list on screen is spared. Reading Qt's source, the page that is visible when the stack is torn down takes a different path through the layout code, so this looks like an accident of the teardown order, not a guard.
  • I have not run #990 for this case. It shortens the freeze, which by itself would not help a window that is not drawn.
  • macOS arm64 / Qt 6.9.0, isolated regtest. Payments and blocks came over RPC.
This has no time limit while the window is not being drawn, and a small wallet is enough. A window that is minimized, hidden or completely covered by another window lays nothing out, so a change that arrives then stays pending until the window is shown again. A quit in that state crashes if the changed wallet's **Activity** list is not the page on screen. At `2bd5a61e8304`, native window, 30-transaction wallet, payment sent from outside the app so that exactly one open wallet changes, window minimized or hidden first, quit 10 to 30 s later: | Case | Crashes | |---|---| | One wallet, app left on its start page | 8 of 8 | | One wallet, **Receive** / block clock / **Settings** showing | 5 of 5 / 11 of 11 / 5 of 5 | | One wallet, **Activity** showing | 0 of 17 | | Two wallets, the change in a wallet that is not selected or not on its **Activity** tab | 109 of 109 | | Two wallets, the change only in the selected wallet, **Activity** showing | 0 of 38 | | Nothing changed in the wallet | 0 of 14 | With a payment between two open wallets it was 101 of 101, with waits from 5 s to 600 s before the quit. Without minimizing, **Receive** showing, quit 15 s after the payment: | Case | Crashes | |---|---| | Window in front when the payment arrived | 0 of 16 | | Window completely covered by another window, change not laid out at the quit | 5 of 5 | So a node started with one wallet and left on its start page, then minimized, hidden or left completely covered by other windows, crashes on quit once a payment or a confirmation has arrived, unless its window is brought forward first. Nothing in the wallet has to be opened. One frame is enough to clear the state: in the one covered launch where the window was exposed for a moment before the quit, the quit was clean. One case where a crash did cost something: a legacy wallet update in progress. With a second open wallet in the crashing state, Quit during **Update wallet** crashed 7 of 7, before the node was told to shut down, so the update was neither finished nor rolled back. The wallet was left half-converted: it would not open, a second update was refused as "already a descriptor wallet", and the backup could not be imported (#629). Copying the `.legacy.bak` over `wallet.dat` by hand restored it. Without the crashing state the same quit was clean, 6 of 6, and the original wallet was restored. That roll back is what Core does when the wallet is behind the chain tip; a wallet at the tip keeps the finished update after a clean quit (3 of 3 each way, offscreen, with a 15,000-key wallet written by Bitcoin Core 29.0). The crash runs used a hand-built 60,001-key legacy wallet, whose update lasted tens of seconds. With the 29.0 wallet I repeated only the kill, with `bitcoind` alone: it leaves the same half-converted state, 6 of 6. The application quit event and SIGTERM behaved the same. Each crash exits with SIGSEGV and `debug.log` has no `Shutdown done`. `eed1f426fcb6` gave the same split, 8 of 8 against 0 of 5. Limits: - Minimize, hide and raise were the window's own `showMinimized()`, `hide()` and `raise()` calls made through the test bridge, and the cover was a second app window. I did not use the yellow button, Cmd+M, the Dock or the tray menu, no physical Cmd+Q, and nothing was checked on a screen. - I did not read a crash report for these cases. The link to the trace above rests on the same exit signal, the same last log line and the same controls. - I do not know why the list on screen is spared. Reading Qt's source, the page that is visible when the stack is torn down takes a different path through the layout code, so this looks like an accident of the teardown order, not a guard. - I have not run #990 for this case. It shortens the freeze, which by itself would not help a window that is not drawn. - macOS arm64 / Qt 6.9.0, isolated regtest. Payments and blocks came over RPC.
jarolrod commented 2026-11-13 17:55:04 +00:00 (Migrated from github.com)

The same crash can be reached without quitting: unloading a wallet in this state kills the app.

When a wallet is unloaded or closed, its view is destroyed while the app keeps running, and that takes the same Qt path as the page stack at quit. If that wallet's Activity list holds a change that no frame has laid out, and the list is not the page on screen, the app exits with SIGSEGV. With bitcoin-cli unloadwallet it was gone 0.05 to 0.15 s after the call. debug.log ends at Releasing wallet, the node is not shut down, and the other open wallets go down with it.

At 2bd5a61e8304, native window, wallet A open and not showing its Activity list, window minimized, one payment to A from a wallet that is not open in the app, then bitcoin-cli unloadwallet A 1 to 3 s later:

Case Crashes
A has two transactions 15 of 15
A has three / five transactions 3 of 3 / 3 of 3
unloadwallet 30 s / 120 s after the payment 3 of 4 / 2 of 2
A block that confirms an earlier payment, instead of a payment 6 of 7
Only A open, Receive showing / app left on its start page 3 of 3 / 2 of 2
A has one transaction / none 0 of 9 / 0 of 3
No payment 0 of 5
A on screen with Activity showing 0 of 5
Another open wallet unloaded, not A 0 of 5
Window shown and the change drawn before the unload 0 of 6

What counts is the number of rows in the list when the change arrives, not their dates. A single row is spared at quit as well: with a quit in place of the unload it was 0 of 4 with one transaction against 3 of 4 with two. I do not know why. The list also has to have been laid out once since the wallet was opened: in 3 launches where the window had never been drawn, the unload was clean.

A window that is shown but not drawn behaves like a minimized one. In 7 launches the window was shown and not active, a read through the test bridge showed the change still not laid out after 2 s, and unloadwallet crashed 7 of 7. I take it the window was behind other windows.

The app's own Close wallet takes the same path, but I only got there with clicks delivered through the test bridge to a window that was not drawn: 3 of 3 minimized, 3 of 3 hidden, 0 of 2 without a payment. After the window was restored the change was laid out within 0.03 to 0.6 s, and Close wallet was then clean, 12 of 12. So I could not produce it the way a person would click.

DesktopWallets.qml keeps one WalletView per open wallet in a Repeater and drops the view as soon as the wallet becomes unavailable (DesktopWallets.qml#L46-L56, #L444-L470). Each view owns that wallet's Activity StackView (WalletView.qml#L180-L190). Two crash reports from these launches have the four frames above, setSectionHelper to updateSections, at address 0x8 under ~QQuickStackElement and ~QQuickStackView. Below them is the deferred delete of the wallet's view inside QCoreApplication::exec(), not main.clear(). So keeping the stack alive until node shutdown has finished would not cover this route. Detaching the list's model or section delegate before a wallet's view is destroyed would cover both.

eed1f426fcb6 behaved the same, 1 of 1.

Limits:

  • unloadwallet was sent with bitcoin-cli, which needs the RPC server. That is off by default in the app. I did not try the app's own console.
  • Minimize, hide and restore were the window's own calls made through the test bridge. I did not use the yellow button, the Dock or the tray, and nothing was checked on a screen.
  • Five launches without a crash are not explained: one at 30 s, one with a confirming block, one quit with two transactions, and two with a hidden window. I had no read of the list in them.
  • I could not cover the window deliberately with a second window of the app, so the not-drawn row comes from launches where the window opened that way by itself.
  • macOS wrote crash reports for 2 of the 65 crashes on unload or close. The other cells rest on exit code -11 and the same last log lines.
  • I did not run #990 for this. Its diff does not touch how a wallet's view is destroyed.
  • macOS arm64 / Qt 6.9.0, isolated regtest. Payments and blocks came over RPC.
The same crash can be reached without quitting: unloading a wallet in this state kills the app. When a wallet is unloaded or closed, its view is destroyed while the app keeps running, and that takes the same Qt path as the page stack at quit. If that wallet's **Activity** list holds a change that no frame has laid out, and the list is not the page on screen, the app exits with SIGSEGV. With `bitcoin-cli unloadwallet` it was gone 0.05 to 0.15 s after the call. `debug.log` ends at `Releasing wallet`, the node is not shut down, and the other open wallets go down with it. At `2bd5a61e8304`, native window, wallet A open and not showing its **Activity** list, window minimized, one payment to A from a wallet that is not open in the app, then `bitcoin-cli unloadwallet A` 1 to 3 s later: | Case | Crashes | |---|---| | A has two transactions | 15 of 15 | | A has three / five transactions | 3 of 3 / 3 of 3 | | `unloadwallet` 30 s / 120 s after the payment | 3 of 4 / 2 of 2 | | A block that confirms an earlier payment, instead of a payment | 6 of 7 | | Only A open, **Receive** showing / app left on its start page | 3 of 3 / 2 of 2 | | A has one transaction / none | 0 of 9 / 0 of 3 | | No payment | 0 of 5 | | A on screen with **Activity** showing | 0 of 5 | | Another open wallet unloaded, not A | 0 of 5 | | Window shown and the change drawn before the unload | 0 of 6 | What counts is the number of rows in the list when the change arrives, not their dates. A single row is spared at quit as well: with a quit in place of the unload it was 0 of 4 with one transaction against 3 of 4 with two. I do not know why. The list also has to have been laid out once since the wallet was opened: in 3 launches where the window had never been drawn, the unload was clean. A window that is shown but not drawn behaves like a minimized one. In 7 launches the window was shown and not active, a read through the test bridge showed the change still not laid out after 2 s, and `unloadwallet` crashed 7 of 7. I take it the window was behind other windows. The app's own **Close wallet** takes the same path, but I only got there with clicks delivered through the test bridge to a window that was not drawn: 3 of 3 minimized, 3 of 3 hidden, 0 of 2 without a payment. After the window was restored the change was laid out within 0.03 to 0.6 s, and **Close wallet** was then clean, 12 of 12. So I could not produce it the way a person would click. `DesktopWallets.qml` keeps one `WalletView` per open wallet in a `Repeater` and drops the view as soon as the wallet becomes unavailable ([DesktopWallets.qml#L46-L56](https://github.com/bitcoin-core/gui-qml/blob/2bd5a61e8304d5143e32f1ce977a2de2aceb6413/qml/pages/wallet/DesktopWallets.qml#L46-L56), [#L444-L470](https://github.com/bitcoin-core/gui-qml/blob/2bd5a61e8304d5143e32f1ce977a2de2aceb6413/qml/pages/wallet/DesktopWallets.qml#L444-L470)). Each view owns that wallet's Activity `StackView` ([WalletView.qml#L180-L190](https://github.com/bitcoin-core/gui-qml/blob/2bd5a61e8304d5143e32f1ce977a2de2aceb6413/qml/pages/wallet/WalletView.qml#L180-L190)). Two crash reports from these launches have the four frames above, `setSectionHelper` to `updateSections`, at address 0x8 under `~QQuickStackElement` and `~QQuickStackView`. Below them is the deferred delete of the wallet's view inside `QCoreApplication::exec()`, not `main.clear()`. So keeping the stack alive until node shutdown has finished would not cover this route. Detaching the list's model or section delegate before a wallet's view is destroyed would cover both. `eed1f426fcb6` behaved the same, 1 of 1. Limits: - `unloadwallet` was sent with `bitcoin-cli`, which needs the RPC server. That is off by default in the app. I did not try the app's own console. - Minimize, hide and restore were the window's own calls made through the test bridge. I did not use the yellow button, the Dock or the tray, and nothing was checked on a screen. - Five launches without a crash are not explained: one at 30 s, one with a confirming block, one quit with two transactions, and two with a hidden window. I had no read of the list in them. - I could not cover the window deliberately with a second window of the app, so the not-drawn row comes from launches where the window opened that way by itself. - macOS wrote crash reports for 2 of the 65 crashes on unload or close. The other cells rest on exit code -11 and the same last log lines. - I did not run #990 for this. Its diff does not touch how a wallet's view is destroyed. - macOS arm64 / Qt 6.9.0, isolated regtest. Payments and blocks came over RPC.
Sign in to join this conversation.
No description provided.