Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

qt: Use qInfo() if no error occurs #16263

Merged
merged 1 commit into from
Jun 24, 2019
Merged

Conversation

hebasto
Copy link
Member

@hebasto hebasto commented Jun 21, 2019

Warning and Debugging Messages:

  • qInfo() is used for informational messages.
  • qWarning() is used to report warnings and recoverable errors in your
    application.

If the QT_FATAL_WARNINGS environment variable is set, qWarning() exits after printing the warning message. This makes it easy to obtain a backtrace in the debugger.

qWarning():

Calls the message handler with the warning message message... This function does nothing if QT_NO_WARNING_OUTPUT was defined during compilation; it exits if at the nth warning corresponding to the counter in environment variable QT_FATAL_WARNINGS.

This PR allows more productive debugging using the environment variable QT_FATAL_WARNINGS.

Examples:

The behavior, when option -debug=qt is set/unset, remains unchanged.

qWarning() is used to report warnings and recoverable errors in your 
application.
qInfo() is used for informational messages (since Qt 5.5).
@hebasto
Copy link
Member Author

hebasto commented Jun 21, 2019

ping @promag

@promag
Copy link
Contributor

promag commented Jun 21, 2019

ACK a2aabfb, I also have this change locally.

@Empact
Copy link
Contributor

Empact commented Jun 22, 2019

ACK a2aabfb

Copy link
Member

@fanquake fanquake left a comment

Choose a reason for hiding this comment

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

ACK a2aabfb.

Using master and setting QT_FATAL_WARNINGS=1, Qt bombs out at the first usage of qWarning():

2019-06-23T10:21:21Z UpdateTip: new best=000000000000000000b6a9e3c4aa5619a48023818df48f757f8fff650b51de85 height=494994 version=0x20000002 log2_work=87.490425 tx=272517027 date='2017-11-18T23:38:38Z' progress=0.642811 cache=4.2MiB(31387txo)
2019-06-23T10:21:21Z UpdateTip: new best=000000000000000000aa16a81a9b3b74f47f07bd6184705a3525e8325dffa54f height=494995 version=0x20000000 log2_work=87.490464 tx=272519017 date='2017-11-19T00:03:10Z' progress=0.642816 cache=5.2MiB(39744txo)
2019-06-23T10:21:21Z UpdateTip: new best=00000000000000000076be6678a2efa7793f98900ac0490863514f291e0f90f8 height=494996 version=0x20000000 log2_work=87.490502 tx=272519980 date='2017-11-19T00:03:48Z' progress=0.642818 cache=6.1MiB(47055txo)
2019-06-23T10:21:21Z GUI: Platform customization: "macosx"

With these changes, I still saw at least one segfault (a restart without QT_FATAL_WARNINGS=1 fixed this):

bash-3.2$ lldb Bitcoin-Qt.app -- -regtest
(lldb) target create "Bitcoin-Qt.app"
Current executable set to 'Bitcoin-Qt.app' (x86_64).
(lldb) settings set -- target.run-args  "-regtest"
(lldb) env QT_FATAL_WARNINGS=1
(lldb) run
Process 77848 launched: '/Users/michael/github/bitcoin/Bitcoin-Qt.app/Contents/MacOS/Bitcoin-Qt' (x86_64)
2019-06-23 21:32:45.810272+0800 Bitcoin-Qt[77848:246558] MessageTracer: Falling back to default whitelist
Process 77848 stopped
* thread #1, name = 'bitcoin-main', queue = 'com.apple.main-thread', stop reason = signal SIGABRT
    frame #0: 0x00007fff7e3be2c6 libsystem_kernel.dylib`__pthread_kill + 10
libsystem_kernel.dylib`__pthread_kill:
->  0x7fff7e3be2c6 <+10>: jae    0x7fff7e3be2d0            ; <+20>
    0x7fff7e3be2c8 <+12>: movq   %rax, %rdi
    0x7fff7e3be2cb <+15>: jmp    0x7fff7e3b8457            ; cerror_nocancel
    0x7fff7e3be2d0 <+20>: retq   
Target 0: (Bitcoin-Qt) stopped.

debug.log:

2019-06-23T13:34:33Z msghand thread start
2019-06-23T13:34:33Z init message: Done loading
2019-06-23T13:34:33Z GUI: Platform customization: "macosx"
2019-06-23T13:34:33Z GUI: Window position QRect(-4,85 836x510) outside any known screen, using primary screen

Note: 32 instances of qWarning() left with the bulk in paymentrequest & payment server code.

@fanquake fanquake requested a review from jonasschnelli June 23, 2019 13:51
@laanwj
Copy link
Member

laanwj commented Jun 23, 2019

I think the historical reason these are not qInfo is that some older Qt versions didn't have that. But I think that was pre-qt5.
ACK a2aabfb

Edit: Eh, no https://doc.qt.io/qt-5/qtglobal.html#qInfo

This function was introduced in Qt 5.5.

I guess that's ok now that 5.5.1 is the minimum.

@fanquake fanquake merged commit a2aabfb into bitcoin:master Jun 24, 2019
fanquake added a commit that referenced this pull request Jun 24, 2019
a2aabfb Use qInfo() if no error occurs (Hennadii Stepanov)

Pull request description:

  [Warning and Debugging Messages](https://doc.qt.io/qt-5/debug.html#warning-and-debugging-messages):
  > - `qInfo()` is used for informational messages.
  > - `qWarning()` is used to report warnings and recoverable errors in your
  application.
  >
  > If the `QT_FATAL_WARNINGS` environment variable is set, `qWarning()` exits after printing the warning message. This makes it easy to obtain a backtrace in the debugger.

  [`qWarning()`](https://doc.qt.io/qt-5/qtglobal.html#qWarning):
  > Calls the message handler with the warning message message... This function does nothing if `QT_NO_WARNING_OUTPUT` was defined during compilation; it exits if at the nth warning corresponding to the counter in environment variable `QT_FATAL_WARNINGS`.

  This PR allows more productive debugging using the environment variable `QT_FATAL_WARNINGS`.

  Examples:
  - #16118 (comment)
  - #16254 (comment)

  The behavior, when option `-debug=qt` is set/unset, remains unchanged.

ACKs for commit a2aabf:
  promag:
    ACK a2aabfb, I also have this change locally.
  Empact:
    ACK a2aabfb
  laanwj:
    ACK a2aabfb
  fanquake:
    ACK a2aabfb.

Tree-SHA512: b4df300c9c00a1705b0d3a10227e3deaac19a98b0a898bb60d5a88872cf450fb131eba150d9dd6c29e021566ee04b3b86b7d486bbe28bd894743c128d2309155
@hebasto hebasto deleted the 20190621-qInfo branch June 24, 2019 06:47
jasonbcox pushed a commit to Bitcoin-ABC/bitcoin-abc that referenced this pull request Nov 12, 2020
Summary:
> qWarning() is used to report warnings and recoverable errors in your
> application.
> qInfo() is used for informational messages (since Qt 5.5).

This is a backport of Core [[bitcoin/bitcoin#16263 | PR16263]]

Test Plan:
Those messages can be printed with this command:
`src/qt/bitcoin-qt -printtoconsole  -debug=qt | grep "GUI:"`

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Differential Revision: https://reviews.bitcoinabc.org/D8372
Munkybooty pushed a commit to Munkybooty/dash that referenced this pull request Oct 30, 2021
a2aabfb Use qInfo() if no error occurs (Hennadii Stepanov)

Pull request description:

  [Warning and Debugging Messages](https://doc.qt.io/qt-5/debug.html#warning-and-debugging-messages):
  > - `qInfo()` is used for informational messages.
  > - `qWarning()` is used to report warnings and recoverable errors in your
  application.
  >
  > If the `QT_FATAL_WARNINGS` environment variable is set, `qWarning()` exits after printing the warning message. This makes it easy to obtain a backtrace in the debugger.

  [`qWarning()`](https://doc.qt.io/qt-5/qtglobal.html#qWarning):
  > Calls the message handler with the warning message message... This function does nothing if `QT_NO_WARNING_OUTPUT` was defined during compilation; it exits if at the nth warning corresponding to the counter in environment variable `QT_FATAL_WARNINGS`.

  This PR allows more productive debugging using the environment variable `QT_FATAL_WARNINGS`.

  Examples:
  - bitcoin#16118 (comment)
  - bitcoin#16254 (comment)

  The behavior, when option `-debug=qt` is set/unset, remains unchanged.

ACKs for commit a2aabf:
  promag:
    ACK a2aabfb, I also have this change locally.
  Empact:
    ACK bitcoin@a2aabfb
  laanwj:
    ACK a2aabfb
  fanquake:
    ACK a2aabfb.

Tree-SHA512: b4df300c9c00a1705b0d3a10227e3deaac19a98b0a898bb60d5a88872cf450fb131eba150d9dd6c29e021566ee04b3b86b7d486bbe28bd894743c128d2309155
Munkybooty pushed a commit to Munkybooty/dash that referenced this pull request Oct 30, 2021
a2aabfb Use qInfo() if no error occurs (Hennadii Stepanov)

Pull request description:

  [Warning and Debugging Messages](https://doc.qt.io/qt-5/debug.html#warning-and-debugging-messages):
  > - `qInfo()` is used for informational messages.
  > - `qWarning()` is used to report warnings and recoverable errors in your
  application.
  >
  > If the `QT_FATAL_WARNINGS` environment variable is set, `qWarning()` exits after printing the warning message. This makes it easy to obtain a backtrace in the debugger.

  [`qWarning()`](https://doc.qt.io/qt-5/qtglobal.html#qWarning):
  > Calls the message handler with the warning message message... This function does nothing if `QT_NO_WARNING_OUTPUT` was defined during compilation; it exits if at the nth warning corresponding to the counter in environment variable `QT_FATAL_WARNINGS`.

  This PR allows more productive debugging using the environment variable `QT_FATAL_WARNINGS`.

  Examples:
  - bitcoin#16118 (comment)
  - bitcoin#16254 (comment)

  The behavior, when option `-debug=qt` is set/unset, remains unchanged.

ACKs for commit a2aabf:
  promag:
    ACK a2aabfb, I also have this change locally.
  Empact:
    ACK bitcoin@a2aabfb
  laanwj:
    ACK a2aabfb
  fanquake:
    ACK a2aabfb.

Tree-SHA512: b4df300c9c00a1705b0d3a10227e3deaac19a98b0a898bb60d5a88872cf450fb131eba150d9dd6c29e021566ee04b3b86b7d486bbe28bd894743c128d2309155
Munkybooty pushed a commit to Munkybooty/dash that referenced this pull request Nov 2, 2021
a2aabfb Use qInfo() if no error occurs (Hennadii Stepanov)

Pull request description:

  [Warning and Debugging Messages](https://doc.qt.io/qt-5/debug.html#warning-and-debugging-messages):
  > - `qInfo()` is used for informational messages.
  > - `qWarning()` is used to report warnings and recoverable errors in your
  application.
  >
  > If the `QT_FATAL_WARNINGS` environment variable is set, `qWarning()` exits after printing the warning message. This makes it easy to obtain a backtrace in the debugger.

  [`qWarning()`](https://doc.qt.io/qt-5/qtglobal.html#qWarning):
  > Calls the message handler with the warning message message... This function does nothing if `QT_NO_WARNING_OUTPUT` was defined during compilation; it exits if at the nth warning corresponding to the counter in environment variable `QT_FATAL_WARNINGS`.

  This PR allows more productive debugging using the environment variable `QT_FATAL_WARNINGS`.

  Examples:
  - bitcoin#16118 (comment)
  - bitcoin#16254 (comment)

  The behavior, when option `-debug=qt` is set/unset, remains unchanged.

ACKs for commit a2aabf:
  promag:
    ACK a2aabfb, I also have this change locally.
  Empact:
    ACK bitcoin@a2aabfb
  laanwj:
    ACK a2aabfb
  fanquake:
    ACK a2aabfb.

Tree-SHA512: b4df300c9c00a1705b0d3a10227e3deaac19a98b0a898bb60d5a88872cf450fb131eba150d9dd6c29e021566ee04b3b86b7d486bbe28bd894743c128d2309155
Munkybooty pushed a commit to Munkybooty/dash that referenced this pull request Nov 2, 2021
a2aabfb Use qInfo() if no error occurs (Hennadii Stepanov)

Pull request description:

  [Warning and Debugging Messages](https://doc.qt.io/qt-5/debug.html#warning-and-debugging-messages):
  > - `qInfo()` is used for informational messages.
  > - `qWarning()` is used to report warnings and recoverable errors in your
  application.
  >
  > If the `QT_FATAL_WARNINGS` environment variable is set, `qWarning()` exits after printing the warning message. This makes it easy to obtain a backtrace in the debugger.

  [`qWarning()`](https://doc.qt.io/qt-5/qtglobal.html#qWarning):
  > Calls the message handler with the warning message message... This function does nothing if `QT_NO_WARNING_OUTPUT` was defined during compilation; it exits if at the nth warning corresponding to the counter in environment variable `QT_FATAL_WARNINGS`.

  This PR allows more productive debugging using the environment variable `QT_FATAL_WARNINGS`.

  Examples:
  - bitcoin#16118 (comment)
  - bitcoin#16254 (comment)

  The behavior, when option `-debug=qt` is set/unset, remains unchanged.

ACKs for commit a2aabf:
  promag:
    ACK a2aabfb, I also have this change locally.
  Empact:
    ACK bitcoin@a2aabfb
  laanwj:
    ACK a2aabfb
  fanquake:
    ACK a2aabfb.

Tree-SHA512: b4df300c9c00a1705b0d3a10227e3deaac19a98b0a898bb60d5a88872cf450fb131eba150d9dd6c29e021566ee04b3b86b7d486bbe28bd894743c128d2309155
Munkybooty pushed a commit to Munkybooty/dash that referenced this pull request Nov 4, 2021
a2aabfb Use qInfo() if no error occurs (Hennadii Stepanov)

Pull request description:

  [Warning and Debugging Messages](https://doc.qt.io/qt-5/debug.html#warning-and-debugging-messages):
  > - `qInfo()` is used for informational messages.
  > - `qWarning()` is used to report warnings and recoverable errors in your
  application.
  >
  > If the `QT_FATAL_WARNINGS` environment variable is set, `qWarning()` exits after printing the warning message. This makes it easy to obtain a backtrace in the debugger.

  [`qWarning()`](https://doc.qt.io/qt-5/qtglobal.html#qWarning):
  > Calls the message handler with the warning message message... This function does nothing if `QT_NO_WARNING_OUTPUT` was defined during compilation; it exits if at the nth warning corresponding to the counter in environment variable `QT_FATAL_WARNINGS`.

  This PR allows more productive debugging using the environment variable `QT_FATAL_WARNINGS`.

  Examples:
  - bitcoin#16118 (comment)
  - bitcoin#16254 (comment)

  The behavior, when option `-debug=qt` is set/unset, remains unchanged.

ACKs for commit a2aabf:
  promag:
    ACK a2aabfb, I also have this change locally.
  Empact:
    ACK bitcoin@a2aabfb
  laanwj:
    ACK a2aabfb
  fanquake:
    ACK a2aabfb.

Tree-SHA512: b4df300c9c00a1705b0d3a10227e3deaac19a98b0a898bb60d5a88872cf450fb131eba150d9dd6c29e021566ee04b3b86b7d486bbe28bd894743c128d2309155
Munkybooty pushed a commit to Munkybooty/dash that referenced this pull request Nov 16, 2021
a2aabfb Use qInfo() if no error occurs (Hennadii Stepanov)

Pull request description:

  [Warning and Debugging Messages](https://doc.qt.io/qt-5/debug.html#warning-and-debugging-messages):
  > - `qInfo()` is used for informational messages.
  > - `qWarning()` is used to report warnings and recoverable errors in your
  application.
  >
  > If the `QT_FATAL_WARNINGS` environment variable is set, `qWarning()` exits after printing the warning message. This makes it easy to obtain a backtrace in the debugger.

  [`qWarning()`](https://doc.qt.io/qt-5/qtglobal.html#qWarning):
  > Calls the message handler with the warning message message... This function does nothing if `QT_NO_WARNING_OUTPUT` was defined during compilation; it exits if at the nth warning corresponding to the counter in environment variable `QT_FATAL_WARNINGS`.

  This PR allows more productive debugging using the environment variable `QT_FATAL_WARNINGS`.

  Examples:
  - bitcoin#16118 (comment)
  - bitcoin#16254 (comment)

  The behavior, when option `-debug=qt` is set/unset, remains unchanged.

ACKs for commit a2aabf:
  promag:
    ACK a2aabfb, I also have this change locally.
  Empact:
    ACK bitcoin@a2aabfb
  laanwj:
    ACK a2aabfb
  fanquake:
    ACK a2aabfb.

Tree-SHA512: b4df300c9c00a1705b0d3a10227e3deaac19a98b0a898bb60d5a88872cf450fb131eba150d9dd6c29e021566ee04b3b86b7d486bbe28bd894743c128d2309155
Munkybooty pushed a commit to Munkybooty/dash that referenced this pull request Nov 18, 2021
a2aabfb Use qInfo() if no error occurs (Hennadii Stepanov)

Pull request description:

  [Warning and Debugging Messages](https://doc.qt.io/qt-5/debug.html#warning-and-debugging-messages):
  > - `qInfo()` is used for informational messages.
  > - `qWarning()` is used to report warnings and recoverable errors in your
  application.
  >
  > If the `QT_FATAL_WARNINGS` environment variable is set, `qWarning()` exits after printing the warning message. This makes it easy to obtain a backtrace in the debugger.

  [`qWarning()`](https://doc.qt.io/qt-5/qtglobal.html#qWarning):
  > Calls the message handler with the warning message message... This function does nothing if `QT_NO_WARNING_OUTPUT` was defined during compilation; it exits if at the nth warning corresponding to the counter in environment variable `QT_FATAL_WARNINGS`.

  This PR allows more productive debugging using the environment variable `QT_FATAL_WARNINGS`.

  Examples:
  - bitcoin#16118 (comment)
  - bitcoin#16254 (comment)

  The behavior, when option `-debug=qt` is set/unset, remains unchanged.

ACKs for commit a2aabf:
  promag:
    ACK a2aabfb, I also have this change locally.
  Empact:
    ACK bitcoin@a2aabfb
  laanwj:
    ACK a2aabfb
  fanquake:
    ACK a2aabfb.

Tree-SHA512: b4df300c9c00a1705b0d3a10227e3deaac19a98b0a898bb60d5a88872cf450fb131eba150d9dd6c29e021566ee04b3b86b7d486bbe28bd894743c128d2309155
@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.

6 participants