Skip to content

Conversation

@maflcko
Copy link
Member

@maflcko maflcko commented Jul 10, 2019

Using the same InitError for startup error in the daemon and the gui makes it possible to run the tests with the gui again:

BITCOIND=bitcoin-qt ./test/functional/test_runner.py feature_includeconf feature_config_args

@maflcko maflcko force-pushed the 1907-initErrorGui branch 2 times, most recently from 22229f3 to fa6647a Compare July 10, 2019 13:55
@DrahtBot
Copy link
Contributor

DrahtBot commented Jul 10, 2019

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Conflicts

Reviewers, this pull request conflicts with the following ones:

If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

Copy link
Contributor

@ryanofsky ryanofsky left a comment

Choose a reason for hiding this comment

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

utACK fa6647a. I wonder if it'd be possible to run tests with BITCOIND=bitcoin-qt QT_QPA_PLATFORM=minimal on travis to catch more regressions.

@hebasto
Copy link
Member

hebasto commented Jul 10, 2019

Concept ACK.

Usually, running self-compiled bitcoin-qt on Linux Mint 19.1 I get a message:

$ ./src/qt/bitcoin-qt
qt5ct: using qt5ct plugin

So local run tests on my environment returns errors:

$ BITCOIND=bitcoin-qt ./test/functional/test_runner.py feature_includeconf feature_config_args
Temporary test directory at /tmp/test_runner_₿_🏃_20190710_194358
Traceback (most recent call last):
  File "/home/hebasto/github/bitcoin/test/functional/create_cache.py", line 28, in <module>
    CreateCache().main()
  File "/home/hebasto/github/bitcoin/test/functional/test_framework/test_framework.py", line 218, in main
    self.stop_nodes()
  File "/home/hebasto/github/bitcoin/test/functional/test_framework/test_framework.py", line 397, in stop_nodes
    node.stop_node(wait=wait)
  File "/home/hebasto/github/bitcoin/test/functional/test_framework/test_node.py", line 276, in stop_node
    raise AssertionError("Unexpected stderr {} != {}".format(stderr, expected_stderr))
AssertionError: Unexpected stderr qt5ct: using qt5ct plugin != 
2019-07-10T16:43:58.707000Z TestFramework (INFO): Initializing test directory /tmp/test_runner_₿_🏃_20190710_194358/cache
2019-07-10T16:43:59.616000Z TestFramework (ERROR): Assertion failed
Traceback (most recent call last):
  File "/home/hebasto/github/bitcoin/test/functional/test_framework/test_framework.py", line 191, in main
    self.setup_chain()
  File "/home/hebasto/github/bitcoin/test/functional/test_framework/test_framework.py", line 274, in setup_chain
    self._initialize_chain()
  File "/home/hebasto/github/bitcoin/test/functional/test_framework/test_framework.py", line 514, in _initialize_chain
    self.stop_nodes()
  File "/home/hebasto/github/bitcoin/test/functional/test_framework/test_framework.py", line 397, in stop_nodes
    node.stop_node(wait=wait)
  File "/home/hebasto/github/bitcoin/test/functional/test_framework/test_node.py", line 276, in stop_node
    raise AssertionError("Unexpected stderr {} != {}".format(stderr, expected_stderr))
AssertionError: Unexpected stderr qt5ct: using qt5ct plugin != 
2019-07-10T16:43:59.667000Z TestFramework (INFO): Stopping nodes
[node 0] Cleaning up leftover process
Traceback (most recent call last):
  File "./test/functional/test_runner.py", line 661, in <module>
    main()
  File "./test/functional/test_runner.py", line 324, in main
    runs_ci=args.ci,
  File "./test/functional/test_runner.py", line 356, in run_tests
    subprocess.check_output([sys.executable, tests_dir + 'create_cache.py'] + flags + ["--tmpdir=%s/cache" % tmpdir])
  File "/usr/lib/python3.6/subprocess.py", line 356, in check_output
    **kwargs).stdout
  File "/usr/lib/python3.6/subprocess.py", line 438, in run
    output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['/usr/bin/python3', '/home/hebasto/github/bitcoin/test/functional/create_cache.py', '--cachedir=/home/hebasto/github/bitcoin/test/cache', '--configfile=/home/hebasto/github/bitcoin/test/functional/../config.ini', '--tmpdir=/tmp/test_runner_\u20bf_🏃_20190710_194358/cache']' returned non-zero exit status 1.

@laanwj
Copy link
Member

laanwj commented Jul 11, 2019

InitError was supposed to only be called from the AppInit* functions, to make sure it isn't called before the appropriate listeners are installed. It seems I lost track of how the initialization process works though.

@ryanofsky
Copy link
Contributor

to make sure it isn't called before the appropriate listeners are installed

@laanwj what are "listeners" here? I don't understand what this could be referring to.

@laanwj
Copy link
Member

laanwj commented Jul 11, 2019

@laanwj what are "listeners" here? I don't understand what this could be referring to.

uiInterface signal listeners etc

@maflcko
Copy link
Member Author

maflcko commented Jul 11, 2019

In bitcoind.cpp, I only modify the AppInit function, so the change is obviously correct there.

However, the gui uses a self-brewed AppInit*, I think. One of the first things in GuiMain is to // Subscribe to global signals from core. So it should be fine as well.

I'd presume it would be more difficult to rewrite the Gui init to call the same AppInit function as bitcoind does, so I'd rather not do that.

Copy link
Contributor

@ryanofsky ryanofsky left a comment

Choose a reason for hiding this comment

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

ACK fa6647a again. No changes since last review, I just dug into this a little more. I have some suggestions and questions below, but they are not too important, so feel free to ignore them.

MarcoFalke and others added 2 commits July 11, 2019 19:39
Also, remove unused <boost/thread.hpp> include (and others)
Avoids GUI code calling a node function, and having to live in the same process
as g_ui_signals and uiInterface global variables.
@maflcko maflcko force-pushed the 1907-initErrorGui branch from fa6647a to fa6f402 Compare July 11, 2019 23:40
@hebasto
Copy link
Member

hebasto commented Jul 13, 2019

ACK fa6f402

Tested on Linux Mint 19.1 with system Qt 5.9.5.

The "using qt5ct plugin" message that is printed to stderr by qt5ct can be suppressed by the following environment variable:

QT_LOGGING_RULES="qt5ct.debug=false"

Using this knowledge, feature_includeconf.py passed:

$ BITCOIND=bitcoin-qt QT_LOGGING_RULES="qt5ct.debug=false" ./test/functional/test_runner.py feature_includeconf
Temporary test directory at /tmp/test_runner_₿_🏃_20190713_150236
Remaining jobs: [feature_includeconf.py]
1/1 - feature_includeconf.py passed, Duration: 10 s

TEST                   | STATUS    | DURATION

feature_includeconf.py | ✓ Passed  | 10 s

ALL                    | ✓ Passed  | 10 s (accumulated) 
Runtime: 10 s

And feature_config_args.py passed too:

$ BITCOIND=bitcoin-qt QT_LOGGING_RULES="qt5ct.debug=false" ./test/functional/test_runner.py feature_config_args
Temporary test directory at /tmp/test_runner_₿_🏃_20190713_150609
Remaining jobs: [feature_config_args.py]
1/1 - feature_config_args.py passed, Duration: 17 s

TEST                   | STATUS    | DURATION

feature_config_args.py | ✓ Passed  | 17 s

ALL                    | ✓ Passed  | 17 s (accumulated) 
Runtime: 17 s

@MarcoFalke
Could you add QT_LOGGING_RULES="qt5ct.debug=false" to the OP?

@maflcko maflcko requested a review from laanwj July 15, 2019 13:22
@maflcko
Copy link
Member Author

maflcko commented Jul 15, 2019

Could you add QT_LOGGING_RULES="qt5ct.debug=false" to the OP?

This is specific to your environment. If I add that, I would also have to add XDG_SESSION_TYPE=x11, because someone might be running on Wayland with Gnome and get the Warning: Ignoring XDG_SESSION_TYPE=wayland on Gnome.)

@maflcko maflcko added this to the 0.19.0 milestone Jul 15, 2019
Copy link
Contributor

@ryanofsky ryanofsky left a comment

Choose a reason for hiding this comment

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

utACK fa6f402. Only changes since last review are removing more includes and adding Node::initError method to avoid accessing node InitError function and global variables from GUI code.

@maflcko
Copy link
Member Author

maflcko commented Jul 22, 2019

This pull will be merged some time this week, unless there are objections.

@maflcko
Copy link
Member Author

maflcko commented Jul 23, 2019

Going to merge this, so that the tests pass with the gui

@maflcko maflcko merged commit fa6f402 into bitcoin:master Jul 23, 2019
maflcko pushed a commit that referenced this pull request Jul 23, 2019
fa6f402 Call node->initError instead of InitError from GUI code (Russell Yanofsky)
fad2502 init: Use InitError for all errors in bitcoind/qt (MarcoFalke)

Pull request description:

  Using the same InitError for startup error in the daemon and the gui makes it possible to run the tests with the gui again:

  ```sh
  BITCOIND=bitcoin-qt ./test/functional/test_runner.py feature_includeconf feature_config_args

ACKs for top commit:
  hebasto:
    ACK fa6f402
  ryanofsky:
    utACK fa6f402. Only changes since last review are removing more includes and adding Node::initError method to avoid accessing node `InitError` function and global variables from GUI code.

Tree-SHA512: bd19e08dcea4019dfe40356bc5c63cb583cefed54b6c9dcfb82f1b5b00308d8e2b363549afcaea5e93bf83864dbe0917400c3b70f43a8a5bdff45c9cd34cc294
@maflcko maflcko deleted the 1907-initErrorGui branch July 23, 2019 22:48
deadalnix pushed a commit to Bitcoin-ABC/bitcoin-abc that referenced this pull request Apr 22, 2020
Summary:
**Pull Request#16366**

fa6f402bde146f92ed131e0c9c8e15a55e723307 Call node->initError instead of InitError from GUI code (Russell Yanofsky)
fad2502240a1c440ef03ac3f880475702e418275 init: Use InitError for all errors in bitcoind/qt (MarcoFalke)

Description:

Using the same InitError for startup error in the daemon and the gui makes it possible to run the tests with the gui again: (N.f.B: Depends on D5794)

```sh
BITCOIND=bitcoin-qt ./test/functional/test_runner.py feature_includeconf feature_config_args
```

---

**Pull Request#15864**

ffea41f5301d5582665cf10ba5c2b9547a1443de Enable all tests in feature_config_args.py (Hennadii Stepanov)

Description:

Fix broken `feature_config_args.py` tests (disabled by MarcoFalke@fabe28a0cdcfa13e0e595a0905e3642a960d3077). All test are enabled now.

---

This is a backport of Core [[bitcoin/bitcoin#16366 | PR16366]] with a partial backport of core [[bitcoin/bitcoin#15864 | PR15864]]

Test Plan:
  ninja check check-functional

Reviewers: deadalnix, #bitcoin_abc

Reviewed By: deadalnix, #bitcoin_abc

Differential Revision: https://reviews.bitcoinabc.org/D5807
@hebasto hebasto mentioned this pull request Jan 21, 2021
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Oct 22, 2021
fa6f402 Call node->initError instead of InitError from GUI code (Russell Yanofsky)
fad2502 init: Use InitError for all errors in bitcoind/qt (MarcoFalke)

Pull request description:

  Using the same InitError for startup error in the daemon and the gui makes it possible to run the tests with the gui again:

  ```sh
  BITCOIND=bitcoin-qt ./test/functional/test_runner.py feature_includeconf feature_config_args

ACKs for top commit:
  hebasto:
    ACK fa6f402
  ryanofsky:
    utACK fa6f402. Only changes since last review are removing more includes and adding Node::initError method to avoid accessing node `InitError` function and global variables from GUI code.

Tree-SHA512: bd19e08dcea4019dfe40356bc5c63cb583cefed54b6c9dcfb82f1b5b00308d8e2b363549afcaea5e93bf83864dbe0917400c3b70f43a8a5bdff45c9cd34cc294
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Dec 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants