App can hang after SIGINT during wallet initialization #731

Closed
opened 2026-05-29 13:21:31 +00:00 by johnny9 · 0 comments
johnny9 commented 2026-05-29 13:21:31 +00:00 (Migrated from github.com)

Problem

Sending SIGINT/Ctrl+C while the QML app is still initializing can leave the application running instead of shutting down. This is easiest to reproduce when startup is loading an encrypted wallet.

Observed behavior

  • Start the app with wallet support enabled and an encrypted wallet configured to load on startup.
  • Send Ctrl+C/SIGINT while initialization is still in progress, around wallet loading.
  • Core receives the shutdown request, but the QML app can stay open/running instead of completing shutdown.

Suspected cause

The QML startup path queues shutdown through the same init executor thread that is running appInitMain(). If Core returns false from initialization because shutdown was requested, the QML side currently treats it like a generic initialization error instead of entering the shutdown path. Wallet controller initialization can also run from the failed init result.

Proposed fix direction

  • Treat failed initialization caused by node.shutdownRequested() as a shutdown request.
  • Make QML shutdown handling one-shot.
  • Call node->startShutdown() from all QML shutdown entry points before queued appShutdown().
  • Only initialize/adopt wallets after a successful Core initialization result.

Validation target

Add focused NodeModel coverage for interrupted initialization and one-shot shutdown, plus a smoke test with a disposable regtest datadir and encrypted wallet where SIGINT during Loading wallet… exits cleanly.

## Problem Sending SIGINT/Ctrl+C while the QML app is still initializing can leave the application running instead of shutting down. This is easiest to reproduce when startup is loading an encrypted wallet. ## Observed behavior - Start the app with wallet support enabled and an encrypted wallet configured to load on startup. - Send Ctrl+C/SIGINT while initialization is still in progress, around wallet loading. - Core receives the shutdown request, but the QML app can stay open/running instead of completing shutdown. ## Suspected cause The QML startup path queues shutdown through the same init executor thread that is running `appInitMain()`. If Core returns `false` from initialization because shutdown was requested, the QML side currently treats it like a generic initialization error instead of entering the shutdown path. Wallet controller initialization can also run from the failed init result. ## Proposed fix direction - Treat failed initialization caused by `node.shutdownRequested()` as a shutdown request. - Make QML shutdown handling one-shot. - Call `node->startShutdown()` from all QML shutdown entry points before queued `appShutdown()`. - Only initialize/adopt wallets after a successful Core initialization result. ## Validation target Add focused NodeModel coverage for interrupted initialization and one-shot shutdown, plus a smoke test with a disposable regtest datadir and encrypted wallet where SIGINT during `Loading wallet…` exits cleanly.
Sign in to join this conversation.
No description provided.