Skip to content

Conversation

@promag
Copy link
Contributor

@promag promag commented Nov 22, 2018

Adding the following to bitcoin.conf

[xxx]
disablewallet=1

And running bitcoin-qt gives:

libc++abi.dylib: terminating with uncaught exception of type boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::signals2::no_slots_error> >: boost::signals2::no_slots_error

Fixes regression in #14708.

@promag
Copy link
Contributor Author

promag commented Nov 22, 2018

Alternatively could call noui_connect in src/qt/bitcoin.cpp?

@laanwj
Copy link
Member

laanwj commented Nov 22, 2018

I think the safest solution to this is to not call the message box at all for unrecognized sections. Simply call LogPrintf directly. That's what will happen after all!

@fanquake fanquake added the GUI label Nov 22, 2018
@promag promag force-pushed the 2018-11-fix-noslotserror branch from efb9276 to 3a6a489 Compare November 22, 2018 12:52
@promag promag changed the title qt: Fix boost::signals2::no_slots_error in early calls to InitWarning Replace early calls to InitWarning by LogPrintf Nov 22, 2018
@promag
Copy link
Contributor Author

promag commented Nov 22, 2018

Updated, @MarcoFalke you might want to check this out since you reviewed #14708.

@laanwj
Copy link
Member

laanwj commented Nov 22, 2018

Concept ACK

So to be clear, the problem is that at this stage of initialization, we're not yet able to show message boxes in Qt [1]. @promag's initial fix changed the slot handler to first register a message box handler that only logs, but, it seems safer to simply change these InitWarning calls to LogPrintf as that's what is going to happen both for the UI and bitcoind.

  1. The reason is that there are some things concerning locale and language setup that only can run after configuration parsing, after which the main UI window is created. It might be possible to refactor this at some point but for fixing the issue, this is the safer option.

@promag promag force-pushed the 2018-11-fix-noslotserror branch 2 times, most recently from 1d75da3 to 91ce5a2 Compare November 22, 2018 14:22
@promag promag changed the title Replace early calls to InitWarning by LogPrintf Replace early calls to InitWarning with fprintf(stderr, ...) Nov 22, 2018
@Empact
Copy link
Contributor

Empact commented Nov 22, 2018

May as well match the form of the other warnings in this function, no? They print a leading LogPrintf("%s: ...", __func__, ...).

@promag
Copy link
Contributor Author

promag commented Nov 22, 2018

Now using fprintf(stderr, ...) Instead of LogPrintf so that test/functional/feature_config_args.py passes.

Copy link
Member

@maflcko maflcko left a comment

Choose a reason for hiding this comment

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

Slightly tend to NACK. This makes the code fragile in light of refactoring such as move-only commits, since it is not clear when InitWarning is safe to call. Wouldn't it be easier to always register the no_ui listener to the signal as soon as possible in the initialization sequence (regardless of bitcoind vs bitcoin-qt) and then optionally, if the gui is run, also register the gui message box listener?

Side-note: Previously we wouldn't even log nor print warnings when running the gui, but that is now fixed (see #14162)

src/init.cpp Outdated
Copy link
Member

Choose a reason for hiding this comment

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

InitWarning also prints to the debug log, fprintf does not.

@promag promag force-pushed the 2018-11-fix-noslotserror branch from 91ce5a2 to a0f8df3 Compare November 22, 2018 17:44
@promag
Copy link
Contributor Author

promag commented Nov 22, 2018

Previous fix in 91ce5a2, which @MarcoFalke disapproved.

Current fix does what was suggested in #14783 (comment).

@promag promag changed the title Replace early calls to InitWarning with fprintf(stderr, ...) Fix boost::signals2::no_slots_error in early calls to InitWarning Nov 22, 2018
@maflcko maflcko changed the title Fix boost::signals2::no_slots_error in early calls to InitWarning gui: Fix boost::signals2::no_slots_error in early calls to InitWarning Nov 22, 2018
@maflcko maflcko dismissed their stale review November 22, 2018 17:58

Concept ACK

@promag
Copy link
Contributor Author

promag commented Nov 22, 2018

Not sure about this because I think it should go thru interfaces::Node?

Copy link
Member

@maflcko maflcko left a comment

Choose a reason for hiding this comment

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

Should remove the now-redundant (?) static void InitMessage in src/qt/bitcoin.cpp?

@laanwj
Copy link
Member

laanwj commented Nov 23, 2018

I'm still not sure about this, but ok…

For example:

  • Does noui_register register anything else that might interfere with the GUI?
  • What about the return argument of ThreadSafeMessageBox, will registering multiple handlers cause an issue here (similar for other handlers that noui_register registers)

@promag
Copy link
Contributor Author

promag commented Nov 23, 2018

@laanwj I'm not ignoring them, I'm trying to address them.

@promag
Copy link
Contributor Author

promag commented Nov 23, 2018

@laanwj you mean noui_connect instead of noui_register. Regarding:

  • Does noui_register register anything else that might interfere with the GUI?

noui_connect only connects 3 slots that only call LogPrintf and fprintf, so I think we are safe.

  • What about the return argument of ThreadSafeMessageBox, will registering multiple handlers cause an issue here (similar for other handlers that noui_register registers)

In boost::signals, slot results are combined to give the signal result. The default combiner is to give the last slot result. So the first connected slots are those in noui_connect and later are the UI slots, which means the signal result comes from the UI slots. So it's safe to say there is no behavior change.

@DrahtBot
Copy link
Contributor

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

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #11625 (Add BitcoinApplication & RPCConsole tests by ryanofsky)

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.

@promag promag force-pushed the 2018-11-fix-noslotserror branch from bdf4d55 to 6bbdb20 Compare November 24, 2018 22:17
@jonasschnelli
Copy link
Contributor

Concept ACK

@promag
Copy link
Contributor Author

promag commented Nov 25, 2018

Should remove the now-redundant (?) static void InitMessage in src/qt/bitcoin.cpp?

@MarcoFalke done.

std::unique_ptr<interfaces::Handler> handler_question = node->handleQuestion(noui_ThreadSafeQuestion);
std::unique_ptr<interfaces::Handler> handler_init_message = node->handleInitMessage(noui_InitMessage);

// Do not refer to data directory yet, this can be overridden by Intro::pickDataDirectory
Copy link
Member

Choose a reason for hiding this comment

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

What makes it safe to subscribe to them here already, when some of then log to the debug log, which is in the datadir?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If that was the case then boost::signals2::no_slots_error would have been raised before?

@maflcko
Copy link
Member

maflcko commented Nov 27, 2018

utACK 6bbdb20. Going to test the next time I compile the gui

@Sjors
Copy link
Member

Sjors commented Dec 6, 2018

I can reproduce the error on macOS 10.14.1 and confirm 6bbdb20 fixes it. It shows a Section [xxx] is not recognized. after the command, but someone launching QT via a desktop icon wouldn't see that.

Would be nice to have to test, though that might require #11625

@promag
Copy link
Contributor Author

promag commented Dec 6, 2018

@Sjors thanks, and the improvement can come next.

maflcko pushed a commit to maflcko/bitcoin-core that referenced this pull request Dec 6, 2018
…y calls to InitWarning

6bbdb20 squashme: connect thru node interface (João Barbosa)
a0f8df3 qt: Call noui_connect to prevent boost::signals2::no_slots_error in early calls to InitWarning (João Barbosa)

Pull request description:

  Adding the following to `bitcoin.conf`
  ```
  [xxx]
  disablewallet=1
  ```
  And running `bitcoin-qt` gives:
  ```
  libc++abi.dylib: terminating with uncaught exception of type boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::signals2::no_slots_error> >: boost::signals2::no_slots_error
  ```

  Fixes regression in bitcoin#14708.

Tree-SHA512: 7c158376fad6ebcd80fc0dbe549d5b6e893fb82e7dc1e455825633d7f91b14dc34493487cab7642152e88f9eaf99bfa91988972d600e9fb289cf26afd64aff8a
@maflcko maflcko merged commit 6bbdb20 into bitcoin:master Dec 6, 2018
deadalnix pushed a commit to Bitcoin-ABC/bitcoin-abc that referenced this pull request Apr 22, 2020
…_slots_error in early calls to InitWarning

Summary:
**Merge bitcoin#14783: gui: Fix boost::signals2::no_slots_error in early calls to InitWarning**

6bbdb20 squashme: connect thru node interface (João Barbosa)
a0f8df3 qt: Call noui_connect to prevent boost::signals2::no_slots_error in early calls to InitWarning (João Barbosa)

**Pull request description:**

Adding the following to `bitcoin.conf`
```
[xxx]
disablewallet=1
```
And running `bitcoin-qt` gives:
```
libc++abi.dylib: terminating with uncaught exception of type boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::signals2::no_slots_error> >: boost::signals2::no_slots_error
```

Fixes regression in bitcoin#14708.

---

This is a backport of Core [[bitcoin/bitcoin#14783 | PR14783]]

Test Plan:
  ninja check
  BITCOIND={full_path_to_build_dir}/src/qt/bitcoin-qt ./test/functional/test_runner.py feature_config_args feature_includeconf

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Subscribers: Fabien

Differential Revision: https://reviews.bitcoinabc.org/D5794
ftrader pushed a commit to bitcoin-cash-node/bitcoin-cash-node that referenced this pull request Aug 17, 2020
…_slots_error in early calls to InitWarning

Summary:
**Merge bitcoin#14783: gui: Fix boost::signals2::no_slots_error in early calls to InitWarning**

6bbdb20 squashme: connect thru node interface (João Barbosa)
a0f8df3 qt: Call noui_connect to prevent boost::signals2::no_slots_error in early calls to InitWarning (João Barbosa)

**Pull request description:**

Adding the following to `bitcoin.conf`
```
[xxx]
disablewallet=1
```
And running `bitcoin-qt` gives:
```
libc++abi.dylib: terminating with uncaught exception of type boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::signals2::no_slots_error> >: boost::signals2::no_slots_error
```

Fixes regression in bitcoin#14708.

---

This is a backport of Core [[bitcoin/bitcoin#14783 | PR14783]]

Test Plan:
  ninja check
  BITCOIND={full_path_to_build_dir}/src/qt/bitcoin-qt ./test/functional/test_runner.py feature_config_args feature_includeconf

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Subscribers: Fabien

Differential Revision: https://reviews.bitcoinabc.org/D5794
linuxsh2 pushed a commit to linuxsh2/dash that referenced this pull request Aug 3, 2021
…y calls to InitWarning

6bbdb20 squashme: connect thru node interface (João Barbosa)
a0f8df3 qt: Call noui_connect to prevent boost::signals2::no_slots_error in early calls to InitWarning (João Barbosa)

Pull request description:

  Adding the following to `bitcoin.conf`
  ```
  [xxx]
  disablewallet=1
  ```
  And running `bitcoin-qt` gives:
  ```
  libc++abi.dylib: terminating with uncaught exception of type boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::signals2::no_slots_error> >: boost::signals2::no_slots_error
  ```

  Fixes regression in bitcoin#14708.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants