mirror of
https://github.com/bitcoin-core/gui-qml.git
synced 2026-12-02 08:03:39 +00:00
Keep onboarding, settings and the block clock responsive #981
No reviewers
Labels
No labels
Android
Bug
Build system
Design suggestion
Doc
Needs design review
Needs rebase
Stage
UX
Up for grabs
Upstream
Wallet
duplicate
enhancement
good first issue
question
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
bitcoin-core/gui-qml!981
Loading…
Reference in a new issue
No description provided.
Delete branch "pr/qt6-async-02-settings-blockclock"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Directory checks, configuration reads, settings writes and chain queries can block the GUI. Move this work, port mapping and network controls to workers. Display cached values, report pending work and errors, and ignore outdated results. Keep onboarding previews separate from live startup configuration.
Load block-clock history during initialization, then update it from block notifications. Combine repeated updates and preserve block identity through reorganizations. Update the clock hand each minute without requiring a new block.
Drain workers and release notification subscriptions during shutdown. Restore transaction-diagram cleanup when its component is destroyed.
Completed node-status reads now publish before any follow-up refresh, so overlapping connection and warning notifications cannot starve the visible state. Network notifications remain authoritative over older query results. Gated regression tests cover continuous overlap and a network change during a blocked read.
Keep signer error translations in their existing model context. Show neutral feedback while a new signer path is validated, and defer keyboard/focus-loss checks until validation and saving finish. Disable only settings-editing section stacks during options work, including retained Proxy and Language pages; wallet, console, debug-log and read-only node views remain usable.
Use the same legacy language fallback as startup, including explicit System default and command-line precedence. A first preparation request after shutdown reports failure asynchronously. Accepted preparation keeps its completion during shutdown, and shutdown notification follows all preparation observers so owner cleanup is safe.
Validation at
92fa3864a136: full build, all seven relevant non-QML CTest groups and four startup/shutdown/onboarding functional suites pass. QML sources, resources and fixtures are byte-identical to the previous full-suite pass atdd662d41. The updated AsyncOptions and OnboardingAsync classes pass 32 cases under strict LLVM 22 ASan/LSan/UBSan/integer and 32 under TSan, with only pinned Core suppressions. Matching LLVM 22/Bitcoin-plugin checks pass. Old production fails two language and seven shutdown rows; the simpler early-drain variant also fails the owner-deletion regression.A supplemental current-head ASAN GUI SIGINT check timed out twice at the standard process-exit deadline. Core shutdown and tracked workers completed, and a separate quiescent diagnostic exited cleanly in 21.884 seconds. The intermittent cause remains unproven; this is not counted as a clean standard sanitizer lifecycle pass. No Core assertion or executable-wide suppression was added.
The standalone checkout lacks the requested top-level CI drivers. Configured rootless Docker is available; Core-only fallback attempts are partial and do not validate parent GUI-QML. The IPC-enabled standalone GUI uses a local node factory; actual Core multiprocess IPC lifecycle remains untested and interface_gui.py is absent.
Fixes #960
Fixes #961
Fixes #962
This introduces a regression when selecting the same directory again after fixing its permissions.
I tested this on macOS with Qt 6.9 by picking a directory that wasn't writable, making it writable, then picking it again without restarting the GUI. On the #980 parent (
52a80426831e) that works. Here, the old error sticks around and clicking Start on the last screen does nothing. Picking a different directory first gets around it.Looks like we now update
m_data_dirbefore validation finishes, so selecting it again hits the unchanged-path return insetDataDir()and never checks it again.Could we refresh the preview when someone explicitly picks the same directory? I tried dropping the
source_changedcheck for that case and it works. Would be good to add a test for this too.One small follow-up from testing blocked settings writes: opening Node information still waits on the settings lock when reading the datadir and blocks-dir paths.
I forced the write to stall with a FIFO, so this is a stress case. The synchronous reader is also already in the parent; I wouldn’t hold this PR over it.
Those paths don’t change while the node is running, so caching them once would avoid that wait.
This is fixed now
Node information fixes are in pr3 of my series to remove work off of the Gui thread. I'll go ahead and rebase it and open that draft
rebased
ACK 2eb12ceef2062f336fefab15f66764c3b2826930
Tested ACK 2eb12ceef2062f336fefab15f66764c3b2826930
works perfect with me and the perf issuses were gone
Please rebase.
The threading model looks sound to me: state is confined to the GUI thread, workers return owned results, and moving preview off
SelectParams()removes a real data race. A few sharp edges in the code that tracks request state, none blocking:refreshStatus,runCommand,startPreview, signer validation, network action), each handling failure, rejection and shutdown on its own. The inline defects are all in those paths.submit()is ignored, andshutdown()drops completions. Today only per-model stopping flags prevent stuckpendingstate; this breaks once an executor is shared (#990'sm_commands).refreshStatusdiscards stale results and retries, so it can starve under rapid peer-count changes. Applying the result and refetching once would always converge.BlockClockHistorycalls its callback while holding its mutex. The rule is documented but not enforced; re-entering it would deadlock.~OptionsQmlModelspins a nested event loop until the executor drains. That allows re-entrancy and can hang exit if a settings write stalls.Most of these come from what
BackendExecutorleaves to its callers. I opened #1054 to address them in a follow-up, so none of them block this PR.This now returns
booland reports an error, andOptionsQmlModel::useDefaultDataDir()handles it. The onboarding caller atonboarding_settings.cpp:587still ignores it.Marking both
Persist*DataDirSelectiondeclarations indatadir.h[[nodiscard]]would stop this from happening again.prepareNode()setsm_stopping = true(line 94) to drop in-flight preview results. That makesbeginShutdown()return here without connectingdrainedtoshutdownFinished, so a caller waiting onshutdownFinishedafter node preparation waits forever. Only tests call it today, but registering this model with the shutdown coordinator (asOptionsQmlModelis) would hang shutdown after onboarding.Suggest separating "ignore results" from "shutdown requested", and handling an executor that has already drained:
A test that calls
prepareNode(), waits fornodePrepared, then callsbeginShutdown()and expectsshutdownFinishedwould cover it.Should we check if these values actually changed and emit only for those that changed?
Fixed in
fc3b286738. Snapshot properties now notify only when their cached values change. Added signal-count coverage for successful saves and failed-write rollback.Fixed in
768fa973ee. Onboarding now returns the default-directory save error. Both persistence helpers are[[nodiscard]], all existing callers check the result, and a QSettings write-failure test covers this without relying on filesystem permissions.Fixed in
8d9fbbd9fe. Shutdown requests now have a separate flag, and an already drained executor queuesshutdownFinished. The preparation test checks that shutdown finishes exactly once after success, failure, settings errors and exceptions.@pseudoramdom Addressed the three inline findings in the commits above. The executor-wide follow-ups remain in #1054.
Validation for
8d9fbbd9fe: the final tree is identical to the previously validated version. Native and ASan/LSan/UBSan/integer GUI suites, targeted TSan with instrumented Qt, and IPC startup/shutdown/onboarding tests passed. Lint, Clang 22 with the Bitcoin tidy plugin, and both Core sanitizer CI scripts passed; each Core functional run had 461 passes and 12 skips.interface_gui.pyis absent, so I ran the QML GUI's lifecycle tests.🟠 Minor · An empty -lang leaves the saved startup translation installed
With a saved GUI language and explicitly empty
-lang, the async snapshot reports System default without removing the saved startup translation, leaving the session in the wrong language.Location:
qml/bitcoin.cpp:852(head).🟠 Minor · Blocksonly startup temporarily exposes the Mempool settings section
With
-blocksonly, the initially true availability cache exposes Mempool settings until a post-initialization status snapshot arrives; initialization failure leaves the value uncorrected for the application's remaining lifetime.Location:
qml/models/nodemodel.cpp:299(head).🔵 Suggestion · The onboarding shutdown contract has no production caller
The new
beginShutdown()andshutdownFinishedcontract adds lifecycle branches and tests, but the production owner still destroys the onboarding model directly.Location:
qml/models/onboardingoptionsmodel.cpp:69(head).Review coverage was incomplete.
Reviewed:
19472d4944f1· Full review report · Previous reportspermalink
🟠 Minor · A new onboarding directory temporarily shows the previous directory's error
After a failed preview, selecting another custom directory displays the previous error against the new path and hides the storage-checking message until the new preview completes.
Location: qml/models/onboardingoptionsmodel.cpp:161 (head).
🟠 Minor · An empty -lang leaves the saved startup translation installed
With an empty
-lang=, bitcoin.cpp:572 falls back to the saved QSettings language, but readSnapshot treats the present option as System default. m_language also starts empty, so no languageChanged fires and the saved translation stays installed.Location: qml/bitcoin.cpp:572 (head).
🟠 Minor · Blocksonly startup temporarily exposes the Mempool settings section
nodemodel.h:244 defaults mempoolInformationAvailable to true, and only refreshStatus corrects it. refreshStatus is suppressed until initialization succeeds, so with -blocksonly the Mempool section shows during startup and stays after a failed initialization.
Location: qml/models/nodemodel.h:244 (head).
🔵 Suggestion · The onboarding shutdown contract has no production caller
The new explicit onboarding shutdown state machine is exercised only by tests, while the production owner resets the model directly.
Location: qml/models/onboardingoptionsmodel.cpp:69 (head).
🔵 Suggestion · The initial language snapshot repeats QML translation work
When the initial snapshot matches a nonempty startup language, it still reinstalls translators and retranslates the engine.
Location: qml/bitcoin.cpp:851 (head).
Review coverage was incomplete.
Reviewed:
a1bbbfde6536· Full review reportThe latest human-review findings are fixed in
92fa3864a1and all three threads have replies and are resolved. Legacy language fallback now matches startup, a late preparation request returns a queued failure, and accepted preparation completes before shutdown observers may clean up its owner.The earlier status-publication, signer-translation/pending-state and retained-section fixes remain intact. Their regressions and the prior resolved threads are unchanged; broader executor work remains tracked in #1054.
Validation at
92fa3864a136: full build, all seven relevant non-QML CTest groups and four startup/shutdown/onboarding functional suites pass. QML sources, resources and fixtures are byte-identical to the previous full-suite pass atdd662d41. The updated AsyncOptions and OnboardingAsync classes pass 32 cases under strict LLVM 22 ASan/LSan/UBSan/integer and 32 under TSan, with only pinned Core suppressions. Matching LLVM 22/Bitcoin-plugin checks pass. Old production fails two language and seven shutdown rows; the simpler early-drain variant also fails the owner-deletion regression.Remaining sanitizer qualification: A supplemental current-head ASAN GUI SIGINT check timed out twice at the standard process-exit deadline. Core shutdown and tracked workers completed, and a separate quiescent diagnostic exited cleanly in 21.884 seconds. The intermittent cause remains unproven; this is not counted as a clean standard sanitizer lifecycle pass. No Core assertion or executable-wide suppression was added.
The standalone checkout lacks the requested top-level CI drivers. Configured rootless Docker is available; Core-only fallback attempts are partial and do not validate parent GUI-QML. The IPC-enabled standalone GUI uses a local node factory; actual Core multiprocess IPC lifecycle remains untested and interface_gui.py is absent.
CI follow-up in
19472d4944: the proxy-draft test called an external wallet shortcut that clears cached settings pages, then used stale page/button references. It now uses the normal Settings navigation, real key/mouse input, and retained-page identity/depth checks before Save. All draft and persisted-address assertions remain. The full QML suite passes all 682 cases on CI-matching Qt 6.2. The 26 SettingsNavigation cases also pass on Qt 6.4, Qt 6.10 and audited Qt 6.8 ASan/LSan/UBSan/integer instrumentation with the independently reproduced Qt hash exception. Negative controls still reject missing pending-state gates and discarded drafts. Both fork-push and upstream-PR workflows are tracked. Fork CI.Hosted CI confirmation (2026-11-02 19:49 UTC): the current fork head passes Qt 6.2, Qt 6.4, Qt 6.10 and GUI functional tests. All twelve Linux matrix/GUI jobs across #981, #985 and #990 are green. Upstream PR-triggered runs remain queued. macOS runner-capacity failures were retried; macOS validation remains pending. The earlier validation qualifications above are unchanged.
Additional CI follow-up in
a1bbbfde65: the inherited custom-fee test required exact equality with the final signed transaction size. Pinned Core reproduced a 141-sat fee with a 140-vB transaction after a shorter ECDSA signature, so this was a test defect. The test now uses Core's bounded fee assertion and retains the wallet-minimum override and relay-minimum rejection checks. Shared-path validation passes eleven fee-boundary controls and both instrumented GUI fee scenarios. Only the Python test changed in this follow-up; earlier sanitizer/driver/IPC qualifications remain unchanged. New hosted checks are queued or running on this revision; no result is claimed yet.If this runs while
prepareNode()'s job is still running,shutdown()drops that job's completion, sofinishNodePreparation()never runs andnodePreparedis never emitted.bitcoin.cppwaits for that signal inpreparation_loop, so startup would hang. Before8d9fbbd9fethis was a no-op while preparing.Since
finishNodePreparation()already shuts the executor down, suggest leaving the executor alone while preparing:A test that calls
beginShutdown()while preparation is held on the gated worker, and expects bothnodePreparedandshutdownFinishedexactly once, would cover it.Minor: after shutdown this returns silently, so a caller waiting for
nodePreparedwaits forever. Could it report a failure instead?Users who only have a language in the legacy Qt settings see a mismatch. Startup installs that language through the
ReadLegacyGuiLanguagefallback inbitcoin.cpp, but this read has no such fallback and returns"". Because"" == m_language, the first snapshot no longer emitslanguageChanged. The UI stays in the legacy language while Settings shows "System default", and picking "System default" does nothing, becausesetLanguage("")returns early.Suggest using the same fallback as startup here, as display unit already does with
ReadLegacyGuiDisplayUnita few lines below:Fixed in
92fa3864a1. The snapshot now uses the same legacy language fallback as startup, while an explicit current System default stays empty. legacyLanguageMatchesStartupFallback covers chain/default legacy stores, current and command-line overrides, clearing the language and restarting.Fixed in
92fa3864a1. A request after shutdown now queues nodePrepared(false, error) without starting work. prepareAfterShutdownReportsFailure covers pending and completed previews and repeated shutdown calls; accepted preparation keeps its existing one-shot behavior.Fixed in
92fa3864a1. Accepted preparation keeps its completion, and shutdownFinished is queued from nodePrepared so all preparation observers run before owner cleanup. Gated tests cover success, failure, both exception paths, repeated shutdown and owner deletion. The old code fails all seven shutdown rows; the simpler early-drain connection also fails the owner-deletion case. All 32 focused cases pass under ASan/LSan/UBSan/integer and TSan.ACK
a1bbbfde65