Skip to content

Put BlockClock into an error state if node init fails - #383

Merged
hebasto merged 1 commit into
bitcoin-core:mainfrom
johnny9:node-error-state
Sep 6, 2024
Merged

hebasto merged 1 commit into
bitcoin-core:mainfrom
johnny9:node-error-state

Conversation

@johnny9

@johnny9 johnny9 commented Dec 20, 2023

Copy link
Copy Markdown
Collaborator

Initial step for adding error states to the NodeRunner

Link to github actions build artifacts.

Build Artifacts

@johnny9

johnny9 commented Dec 20, 2023

Copy link
Copy Markdown
Collaborator Author

Tested by starting up a pruned testnet node and then changing the prune settings

Screenshot from 2023-12-19 20-37-07

@MarnixCroes MarnixCroes left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tested: error is displayed when reindex is need, instead of infinite loading on master.

nit: would it be easy to remove HandCursor when there is the error?
as there is nothing to click on

@johnny9

johnny9 commented Dec 21, 2023

Copy link
Copy Markdown
Collaborator Author

nit: would it be easy to remove HandCursor wh

Yeah I noticed that as well. Should probably do that until the pop up view with the details is sorted out.

@pablomartin4btc pablomartin4btc left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Concept ACK

Is it possible to add some small text/ description within the BlockClock? Like what kind of error... "init"? With a tooltip perhaps to show an extended description. As in the brainstorming issue #348 where you can see "No Wifi" within the "Paused" BlockClock state.

@hebasto hebasto changed the title qml: put BlockClock into an error state if node init fails Put BlockClock into an error state if node init fails Jan 1, 2024
@GBKS

GBKS commented Jan 10, 2024

Copy link
Copy Markdown
Contributor

We have some mock-ups for different error types in the design docs (half-way down the page). Ideally, we can always know what the problem was and show a respective icon & message. Maybe not exactly, but the general error source is already helpful.

For errors that cannot be recognized, the mock-ups show "Error" and "Tap for details". If we want to go this route, we need to figure out what is shown when tapping. A full screen with a proper explanation, error log, tips to resolve, etc, like here?

@johnny9

johnny9 commented Jan 10, 2024

Copy link
Copy Markdown
Collaborator Author

Concept ACK

Is it possible to add some small text/ description within the BlockClock? Like what kind of error... "init"? With a tooltip perhaps to show an extended description. As in the brainstorming issue #348 where you can see "No Wifi" within the "Paused" BlockClock state.

This is ultimately the goal. In this PR, I've just implemented the portion that I'm certain about and would likely want to follow up afterwards with the description/details portion.

We have some mock-ups for different error types in the design docs (half-way down the page). Ideally, we can always know what the problem was and show a respective icon & message. Maybe not exactly, but the general error source is already helpful.

For errors that cannot be recognized, the mock-ups show "Error" and "Tap for details". If we want to go this route, we need to figure out what is shown when tapping. A full screen with a proper explanation, error log, tips to resolve, etc, like here?

What to show when tapping is what I'm uncertain about at the moment and was feeling like it might be a chance for me to pretend to be a designer a bit and play with figma. The mobile design looked good and just need to get a basic design for the Desktop.

@pablomartin4btc pablomartin4btc left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tACK 03a8725

I've 2 issues running bitcoin-qt with this change:

1. As soon the app starts up I got these 2 errors regarding qml components
QVariant::load: unknown user type with name BitcoinUnits::Unit.
Running initialization in thread
qrc:/qml/components/BlockClock.qml:33:5: Unable to assign [undefined] to QString
2. After the above, since I got an instance on a pruned node with some corrupted index (due to some break during loadtxoutset) and bitcoin.conf still referencing blockfilterindex=1 and coinstatsindex=1. So, when I remove those indexing settings I got what @MarnixCroes described above -> "infinite loading on master". Should I not get the error icon also in this case? How I can validate this change? @johnny9 could you please add repro instructions on the description?
Error: basic block filter index best block of the index goes beyond pruned data. Please disable the index or reindex (which will download the whole blockchain again)
Error: Failed to start indexes, shutting down.

Complete terminal error logs
~/workspace/bitcoin-core-gui-qml$ ./src/qt/bitcoin-qt 
Warning: Ignoring XDG_SESSION_TYPE=wayland on Gnome. Use QT_QPA_PLATFORM=wayland to run on Wayland anyway.
QVariant::load: unknown user type with name BitcoinUnits::Unit.
Running initialization in thread
qrc:/qml/components/BlockClock.qml:33:5: Unable to assign [undefined] to QString
Error: basic block filter index best block of the index goes beyond pruned data. Please disable the index or reindex (which will download the whole blockchain again)
Error: Failed to start indexes, shutting down.

Co-authored-by: thebagmaster <thebagmaster>
@johnny9

johnny9 commented Jan 29, 2024

Copy link
Copy Markdown
Collaborator Author

Update from 03a8725 to 2b61d22

  • Removed invalid property from BlockClock.qml. this was leftover from previous work on this.

@johnny9

johnny9 commented Jan 29, 2024 •

Copy link
Copy Markdown
Collaborator Author

I've 2 issues running bitcoin-qt with this change:

  1. As soon the app starts up I got these 2 errors regarding qml components
QVariant::load: unknown user type with name BitcoinUnits::Unit.
Running initialization in thread
qrc:/qml/components/BlockClock.qml:33:5: Unable to assign [undefined] to QString

I removed the invalid property in the latest update which resolved that error

  1. After the above, since I got an instance on a pruned node with some corrupted index (due to some break during loadtxoutset) and bitcoin.conf still referencing blockfilterindex=1 and coinstatsindex=1. So, when I remove those indexing settings I got what @MarnixCroes described above -> "infinite loading on master". Should I not get the error icon also in this case? How I can validate this change? @johnny9 could you please add repro instructions on the description?
    Complete terminal error logs

This won't catch all errors and there will need to be an effort to categorize all of these possible error states as well as render a description of what happened to the user.

This change triggers when void NodeModel::initializeResult(bool success, interfaces::BlockAndHeaderTipInfo tip_info) callback has success = false as a parameter. The specific case I use to test is to start up a signet node with prune=1907 (the default you get with our onboarding flow). Then after it syncs a bit, I remove the prune option in my settings.json and restart the app.

@pablomartin4btc pablomartin4btc left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tACK 2b61d22

I've managed to reproduce the errored BlockClock picture when there's another instance of Bitcoin Core running:

image

Also the error reported in previous review regarding the error on BlockClock.qml component doesn't show anymore:

./src/qt/bitcoin-qt -signet
Warning: Ignoring XDG_SESSION_TYPE=wayland on Gnome. Use QT_QPA_PLATFORM=wayland to run on Wayland anyway.
Running initialization in thread
Error: Unable to bind to 0.0.0.0:38333 on this computer. Bitcoin Core is probably already running.
Error: Failed to listen on any port. Use -listen=0 if you want this

@GBKS

GBKS commented Feb 1, 2024

Copy link
Copy Markdown
Contributor

Related, but probably not essential to this PR, here's an idea for handling errors. So on the left, we have this old mock-up for a tooltip that appears when hovering the peers dots, to give you slightly more info about connectivity. Clicking would take you to the peers page.

Now, we can take a similar approach to errors. Based on the type of error, a click can either show the tooltip or take you to the page relevant to this error (the page then needs to show appropriate information).

What do you make of this pattern?

image

@D33r-Gee D33r-Gee left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tested on Ubuntu 22.04 and Android (Galaxy A13)

Was able to reproduce error on Ubuntu 22.04 by deleting the index directory located at .bitcoin/signet/block

For android used Android Studio IDE and deleted the index folder using the device explorer

Suggestion (echoing @GBKS): it would be nice if there was an error message in the GUI similar to what is displayed in terminal, i.e.:
: Error initializing block database. Please restart with -reindex or -reindex-chainstate to recover.

@GBKS

GBKS commented Mar 12, 2024

Copy link
Copy Markdown
Contributor

Please restart with -reindex or -reindex-chainstate to recover.

Is there a way to automatically restart with these options so the user can just click a button?

@MarnixCroes

Copy link
Copy Markdown
Contributor

Please restart with -reindex or -reindex-chainstate to recover.

Is there a way to automatically restart with these options so the user can just click a button?

it's possible, best would be to do it as a follow up imo

@MarnixCroes MarnixCroes left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tACK 2b61d22

@hebasto
hebasto merged commit b979bdc into bitcoin-core:main Sep 6, 2024
johnny9 pushed a commit to johnny9/bitcoin-core-app that referenced this pull request Jul 4, 2025
… node init fails

a87f9d7 qml: Put BlockClock into an Error state if init fails (johnny9)

Pull request description:

  Initial step for adding error states to the NodeRunner

  Link to github actions build artifacts.

  [![Build Artifacts](https://img.shields.io/badge/Build%20Artifacts-green
  )]()

ACKs for top commit:
  pablomartin4btc:
    tACK a87f9d7
  MarnixCroes:
    tACK a87f9d7

Tree-SHA512: 5da6e8cde6e7d24dbd1adffa8014622e188e5ec1abc17b260ba696239c5cc7558a57c6650336549ccfb715cc17fb2b72f28dc107d86e3a21f46f307357525ac7
tx-signer450 added a commit to tx-signer450/gui-qml that referenced this pull request Oct 20, 2025
… node init fails

a87f9d7998bdd6757ffe5a6a6d6ef1aab2bf7387 qml: Put BlockClock into an Error state if init fails (johnny9)

Pull request description:

  Initial step for adding error states to the NodeRunner

  Link to github actions build artifacts.

  [![Build Artifacts](https://img.shields.io/badge/Build%20Artifacts-green
  )]()

ACKs for top commit:
  pablomartin4btc:
    tACK a87f9d7998bdd6757ffe5a6a6d6ef1aab2bf7387
  MarnixCroes:
    tACK a87f9d7998bdd6757ffe5a6a6d6ef1aab2bf7387

Tree-SHA512: 5da6e8cde6e7d24dbd1adffa8014622e188e5ec1abc17b260ba696239c5cc7558a57c6650336549ccfb715cc17fb2b72f28dc107d86e3a21f46f307357525ac7
johnny9 added a commit to johnny9/gui-qml that referenced this pull request Jun 14, 2026
johnny9 pushed a commit to johnny9/gui-qml that referenced this pull request Jun 14, 2026
…it fails

a87f9d7 qml: Put BlockClock into an Error state if init fails (johnny9)

Pull request description:

  Initial step for adding error states to the NodeRunner

  Link to github actions build artifacts.

  [![Build Artifacts](https://img.shields.io/badge/Build%20Artifacts-green
  )]()

ACKs for top commit:
  pablomartin4btc:
    tACK a87f9d7
  MarnixCroes:
    tACK a87f9d7

Rebased-From: b979bdc
Github-Pull: bitcoin-core#383
hebasto pushed a commit to hebasto/gui-qml that referenced this pull request Nov 22, 2026
…nunix platform support and fix race conditions

d5f7524 doc: Bump minimum required Cap'n Proto version to 0.9.2 (Ryan Ofsky)
4898199 build: suppress -Wc++23-lambda-attributes in warn_interface (Ryan Ofsky)
270f5db Squashed 'src/ipc/libmultiprocess/' changes from e8de5c7b68e..acded1aafae (Ryan Ofsky)

Pull request description:

  The changes can be verified by running `test/lint/git-subtree-check.sh src/ipc/libmultiprocess` as described in [developer notes](https://github.com/bitcoin/bitcoin/blob/master/doc/developer-notes.md#subtrees) and [lint instructions](https://github.com/bitcoin/bitcoin/tree/master/test/lint#git-subtree-checksh).

  Changes since last subtree update (#35720):

  - Adds support for nonunix platforms, making API changes that are not backwards compatible ([bitcoin-core#274](bitcoin-core/libmultiprocess#274)). Follow-ups add a `CurrentThread()` accessor matching compatibility code in [bitcoin/bitcoin#35084](bitcoin/bitcoin#35084) ([bitcoin-core#323](bitcoin-core/libmultiprocess#323)) and remove code for Cap'n Proto versions before 0.9 ([bitcoin-core#331](bitcoin-core/libmultiprocess#331)).
  - Fixes a data race between IPC calls running on worker threads and disconnects, found by Antithesis ([bitcoin-core#349](bitcoin-core/libmultiprocess#349)).
  - Fixes a use-after-free when a socket disconnects before `ConnectStream` connects, and leaks and hangs when a client `construct()` call throws ([bitcoin-core#298](bitcoin-core/libmultiprocess#298)).
  - Fixes a race where file descriptors from `SpawnProcess` could leak into processes forked at the same time by other threads, by clearing `FD_CLOEXEC` in the child after forking ([bitcoin-core#311](bitcoin-core/libmultiprocess#311)).
  - Makes `SpawnProcess` report `exec` failures back to the parent and throw, reaping the child ([bitcoin-core#312](bitcoin-core/libmultiprocess#312)).
  - Adds support for `std::chrono::time_point` fields ([bitcoin-core#303](bitcoin-core/libmultiprocess#303)) and for serializing lists of interface objects that need to be moved from ([bitcoin-core#304](bitcoin-core/libmultiprocess#304)), both needed by [bitcoin/bitcoin#10102](bitcoin/bitcoin#10102).
  - Accepts container fields and parameters with any comparator, hash, and allocator types, like Bitcoin Core's `GCSFilter::ElementSet`, needed by [bitcoin/bitcoin#29409](bitcoin/bitcoin#29409) ([bitcoin-core#379](bitcoin-core/libmultiprocess#379)).
  - Finds the `capnp` tool in vcpkg and Windows builds, needed by [bitcoin/bitcoin#32387](bitcoin/bitcoin#32387) ([bitcoin-core#317](bitcoin-core/libmultiprocess#317)).
  - Adds a `destroy_connection` option to `ServeStream` and `ConnectStream`, lets `ServeStream` take ownership of the init object and return the new server and its connection, and adds an `EventLoop::incomingConnections()` accessor, simplifying test setup in both repositories and needed by [bitcoin/bitcoin#35932](bitcoin/bitcoin#35932) ([bitcoin-core#365](bitcoin-core/libmultiprocess#365)).
  - Replaces `EventLoop::post()` with `sync()` taking a `kj::FunctionParam`, avoiding a heap allocation per call ([bitcoin-core#347](bitcoin-core/libmultiprocess#347)).
  - Names threads spawned by the event loop so they can be told apart in tools and logs ([bitcoin-core#324](bitcoin-core/libmultiprocess#324)).
  - Fixes warnings that Bitcoin Core enables or plans to enable: adds `[[noreturn]]` attributes for `-Wmissing-noreturn` ([bitcoin-core#339](bitcoin-core/libmultiprocess#339), for [bitcoin/bitcoin#35911](bitcoin/bitcoin#35911)), and fixes `-Wunused` ([bitcoin-core#362](bitcoin-core/libmultiprocess#362), for [bitcoin/bitcoin#36167](bitcoin/bitcoin#36167)), `-Wunused-const-variable` and `-Wundef` ([bitcoin-core#370](bitcoin-core/libmultiprocess#370)), and `-Wmissing-prototypes` ([bitcoin-core#386](bitcoin-core/libmultiprocess#386), for [bitcoin/bitcoin#36743](bitcoin/bitcoin#36743)) warnings.
  - Fails at compile time with a suggested workaround when Cap'n Proto misdetects exception support (`KJ_NO_EXCEPTIONS`), as happens on NetBSD ([bitcoin-core#364](bitcoin-core/libmultiprocess#364)).
  - Build improvements: fixes stale generated code when the `mpgen` binary changes ([bitcoin-core#316](bitcoin-core/libmultiprocess#316)), fixes `mpgen` link order for static Cap'n Proto builds ([bitcoin-core#367](bitcoin-core/libmultiprocess#367)), links `mpgen` against `kj-async` instead of `capnp-rpc` ([bitcoin-core#327](bitcoin-core/libmultiprocess#327)), shows Cap'n Proto `find_package` diagnostics ([bitcoin-core#325](bitcoin-core/libmultiprocess#325)), installs `type-unordered-set.h` and `version.h` ([bitcoin-core#350](bitcoin-core/libmultiprocess#350)), and shows include-what-you-use errors instead of failing silently ([bitcoin-core#371](bitcoin-core/libmultiprocess#371)).
  - Test, CI, documentation, and minor code improvements: fix for a startup race in the example program ([bitcoin-core#315](bitcoin-core/libmultiprocess#315)), new test for immediate client disconnects in `ListenConnections` ([bitcoin-core#310](bitcoin-core/libmultiprocess#310)), `ReadList` return value check ([bitcoin-core#338](bitcoin-core/libmultiprocess#338)), connect test race fix ([bitcoin-core#343](bitcoin-core/libmultiprocess#343)) and cleanups ([bitcoin-core#344](bitcoin-core/libmultiprocess#344)), `std::ranges::copy` follow-ups ([bitcoin-core#307](bitcoin-core/libmultiprocess#307)), trailing whitespace removal ([bitcoin-core#345](bitcoin-core/libmultiprocess#345)), Cap'n Proto version documentation fix ([bitcoin-core#357](bitcoin-core/libmultiprocess#357)), clang-tidy updates ([bitcoin-core#358](bitcoin-core/libmultiprocess#358), [bitcoin-core#360](bitcoin-core/libmultiprocess#360), [bitcoin-core#380](bitcoin-core/libmultiprocess#380), [bitcoin-core#389](bitcoin-core/libmultiprocess#389)), new CI job testing newer cmake and Cap'n Proto versions ([bitcoin-core#212](bitcoin-core/libmultiprocess#212), [bitcoin-core#359](bitcoin-core/libmultiprocess#359)), CI coverage for the minimum supported g++ ([bitcoin-core#330](bitcoin-core/libmultiprocess#330), [bitcoin-core#366](bitcoin-core/libmultiprocess#366)), new CI warnings ([bitcoin-core#332](bitcoin-core/libmultiprocess#332), [bitcoin-core#341](bitcoin-core/libmultiprocess#341)), CI parallelism ([bitcoin-core#334](bitcoin-core/libmultiprocess#334), [bitcoin-core#356](bitcoin-core/libmultiprocess#356)), CI diagnostics ([bitcoin-core#351](bitcoin-core/libmultiprocess#351), [bitcoin-core#352](bitcoin-core/libmultiprocess#352)), Nix and LLVM updates ([bitcoin-core#296](bitcoin-core/libmultiprocess#296), [bitcoin-core#363](bitcoin-core/libmultiprocess#363)), NetBSD and OpenBSD CI fixes ([bitcoin-core#321](bitcoin-core/libmultiprocess#321), [bitcoin-core#340](bitcoin-core/libmultiprocess#340), [bitcoin-core#381](bitcoin-core/libmultiprocess#381)), building Cap'n Proto with GCC in the 32-bit CI job to avoid an ABI mismatch ([bitcoin-core#383](bitcoin-core/libmultiprocess#383)), and GitHub Actions updates ([bitcoin-core#387](bitcoin-core/libmultiprocess#387)).

  The second commit suppresses the clang `-Wc++23-lambda-attributes` warning, which the new `[[noreturn]]` lambda attribute in `mp/proxy-types.h` triggers in C++20 builds. Since #31507 the Windows build uses clang-cl, so the same flag covers it.

  The third commit updates the minimum Cap'n Proto version in `doc/dependencies.md` to 0.9.2 (1.0 with Clang). This update raises libmultiprocess's own minimum from 0.7 to 0.9 (bitcoin-core/libmultiprocess#331), and libmultiprocess rejects 0.9.0 and 0.9.1 for CVE-2022-46149 and, with Clang 16 or newer, every version before 1.0.

ACKs for top commit:
  fanquake:
    ACK d5f7524
  willcl-ark:
    ACK d5f7524

Tree-SHA512: 4064944f4d8bb6c1665ddc7d5fae838492235d7dfdafab88b19b687ff6892460a3f450b90a145b287866330c569b862d748c941a70c65abc7f273ef13e490fd7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants