Do not block GUI thread in RPCConsole#59
Do not block GUI thread in RPCConsole#59hebasto wants to merge 5 commits intobitcoin-core:masterfrom
Conversation
|
@MarcoFalke Maybe add "Bug" label? |
|
|
||
| void BitcoinGUI::clearGUI() | ||
| { | ||
| trayIconMenu->clear(); |
There was a problem hiding this comment.
The trayIconMenu contains some QAction instances. I think we do not need any chance to activate any of them during shutdown.
There was a problem hiding this comment.
How about trayIconMenu->setEnabled(false) instead?
|
Tested this a bit.
What I'd like to see is:
|
|
Seems like it would be even better to allow multiple RPC executions, and insert the return values in the applicable place :) |
Why? Seems a source of confusion. |
I've made some debugging, and now I believe that this is another issue, which is uncorrelated to #53, and it has nothing to do with the Not sure if #122 should be fixed at all, as it is a pretty edge case, and a possible fix could touch the code at least in three important places. |
Mind looking into #123 ? |
jarolrod
left a comment
There was a problem hiding this comment.
ACK 38efc5a, Tested on macOS 11.1 with Qt 5.15.2
Confirming that I can replicate the bug described in #53 on master.
Confirming that this PR allows me to shutdown the GUI right after calling gettxoutsetinfo both in the Console Window and through bitcoin-cli gettxoutsetinfo after running the GUI with the -server option.
Confirming that I can replicate the issue laid out by @jonasschnelli comment about generate. There is no longer a generate command available in the Console Window, instead I replicated with bitcoin-cli -generate 10000 after running bitcoin-qt with -server. But, this bug is meant to be fixed by #123.
38eb37c qt, rpc: Do not accept command while executing another one (Hennadii Stepanov) 0c32b9c qt, rpc: Accept stop RPC even another command is executing (Hennadii Stepanov) ccf7902 qt, rpc, refactor: Return early in RPCConsole::on_lineEdit_returnPressed (Hennadii Stepanov) 5b9c8c9 qt, rpc: Add "Executing…" message (Hennadii Stepanov) Pull request description: On master (3f512f3) it is possible to enter another command while the current command is still being executed. That makes a mess in the output. With this PR:  Some previous context: #59 (comment) --- It is still possible to enter and execute the `stop` command any time. ACKs for top commit: jarolrod: ACK 38eb37c promag: Tested ACK 38eb37c. Tree-SHA512: 2b37a4b6838bf586b1b5c878192106721f713caeb6252514a6540356aab898986396e0777e73891d331b1be797a4926c20d3f9f38ba2c984ea90d55b0c34f664
…g another one 38eb37c qt, rpc: Do not accept command while executing another one (Hennadii Stepanov) 0c32b9c qt, rpc: Accept stop RPC even another command is executing (Hennadii Stepanov) ccf7902 qt, rpc, refactor: Return early in RPCConsole::on_lineEdit_returnPressed (Hennadii Stepanov) 5b9c8c9 qt, rpc: Add "Executing…" message (Hennadii Stepanov) Pull request description: On master (3f512f3) it is possible to enter another command while the current command is still being executed. That makes a mess in the output. With this PR:  Some previous context: bitcoin-core/gui#59 (comment) --- It is still possible to enter and execute the `stop` command any time. ACKs for top commit: jarolrod: ACK 38eb37c promag: Tested ACK 38eb37c. Tree-SHA512: 2b37a4b6838bf586b1b5c878192106721f713caeb6252514a6540356aab898986396e0777e73891d331b1be797a4926c20d3f9f38ba2c984ea90d55b0c34f664
451ca24 qt, refactor: Drop intermediate BitcoinApplication::shutdownResult slot (Hennadii Stepanov) f3a17bb qt: Do not exit and re-enter main event loop during shutdown (Hennadii Stepanov) b4e0d2c qt, refactor: Allocate SendConfirmationDialog instances on heap (Hennadii Stepanov) 332dea2 qt, refactor: Keep HelpMessageDialog in the main event loop (Hennadii Stepanov) c8bae37 qt, refactor: Keep PSBTOperationsDialog in the main event loop (Hennadii Stepanov) 7fa91e8 qt, refactor: Keep AskPassphraseDialog in the main event loop (Hennadii Stepanov) 6f6fde3 qt, refactor: Keep EditAddressDialog in the main event loop (Hennadii Stepanov) 59f7ba4 qt, refactor: Keep CoinControlDialog in the main event loop (Hennadii Stepanov) 7830cd0 qt, refactor: Keep OptionsDialog in the main event loop (Hennadii Stepanov) 13f6188 qt: Add GUIUtil::ShowModalDialogAndDeleteOnClose (Hennadii Stepanov) Pull request description: On master (1ef34ee) during shutdown `QApplication` exits the main event loop, then re-enter again. This PR streamlines shutdown process by removing the need to interrupt the main event loop, that is required for #59. Also, blocking [`QDialog::exec()`](https://doc.qt.io/qt-5/qdialog.html#exec) calls are replaced with safer [`QDialog::show()`](https://doc.qt.io/qt-5/qwidget.html#show), except for `SendConfirmationDialog` as that change is not trivial (marked as TODO). The [`QDialog::open()`](https://doc.qt.io/qt-5/qdialog.html#open) was not used because the actual modality mode (application modal or window modal) of a dialog depends on whether it has a parent. This PR does not change behavior, and all touched dialogs are still application modal. As a follow up, a design research could suggest to make some dialogs window modal. NOTE for reviewers: quitting app while a dialog is open (e.g., via systray icon menu) must work fine. ACKs for top commit: laanwj: Code review and lighly tested ACK 451ca24 promag: ACK 451ca24, just changed signal to `quitRequested`. Tree-SHA512: ef01ab6ed803b202e776019a4e1f592e816f7bc786e00574b25a0bf16be2374ddf9db21f0a26da08700df7ef0ab9e879550df46dcfe3b6d940f5ed02ca5f8447
Closing. |
Ported from bitcoin/bitcoin#17659.
On master (b4d0366) the GUI thread is blocked with
QThread::wait()duringbitcoin-qtshutdown routine. This causes unresponsive GUI if some commands are passed to the RPC console (#53) before shutdown initiating.This PR:
bitcoin-qtshutdown routine more streamlined: the onlyQApplication::exec()is used inbitcoin-qt. Therefore, the main event loop never interrupts until shutdown.Fix #53