qt: Do not block GUI thread in RPCConsole #17659

pull hebasto wants to merge 5 commits into bitcoin:master from hebasto:20191203-nonblocking-rpcconsole changing 8 files +40 −31
  1. hebasto commented at 8:42 PM on December 3, 2019: member

    On master (35eda631ed3bd23d4a41761a85a96f925d4a6337) the GUI thread is blocked with QThread::wait() during bitcoin-qt shutdown routine. This causes unresponsive GUI if some commands are passed to the RPC console (#13217) before shutdown initiating.

    This PR:

    • removes blocking call and uses additional signal-to-slot connections.
    • makes bitcoin-qt shutdown routine more streamlined: the only QApplication::exec() is used in bitcoin-qt. Therefore, the main event loop never interrupts until shutdown, unlike master and alternative #13674.

    Refs:

    This PR is an alternative to #13674.

    Fix #13217

  2. fanquake added the label GUI on Dec 3, 2019
  3. ryanofsky commented at 9:49 PM on December 3, 2019: contributor

    Fix #13217; this is an alternative to #13674 Fix #17495

    As a side effect, this PR makes bitcoin-qt shutdown routine more streamlined.

    Refs:

    Could you update this with a description of what this PR does? Useful information to include:

    • details about how behavior changed, what behavior was before and after this change
    • a short description of the code changes, what was wrong with the old code, and how the commits relate to each other
    • how this compares to the alternative pr

    It's great to link to other issues and pull requests in a PR description for extra details, but it shouldn't be necessary to open multiple other issues just to have a basic understanding of what a PR does and what motivated it

  4. DrahtBot commented at 12:10 AM on December 4, 2019: contributor

    <!--e57a25ab6845829454e8d69fc972939a-->

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

    <!--174a7506f384e20aa4161008e828411d-->

    Conflicts

    No conflicts as of last run.

  5. promag commented at 1:09 AM on December 4, 2019: member

    Calling waitfornewblock in the GUI console returns immediately.

  6. hebasto commented at 3:51 AM on December 4, 2019: member

    Calling waitfornewblock in the GUI console returns immediately.

    I have observed such behavior on regtest only once, and cannot reproduce anymore.

    Could you provide steps to reproduce an issue reliably?

  7. hebasto commented at 10:12 AM on December 4, 2019: member

    @ryanofsky

    OP has been updated.

  8. promag commented at 2:12 PM on December 4, 2019: member

    @hebasto actually it's unrelated to this change. Just noticed that waitfornewblock returns immediately in the GUI console because IsRPCRunning is false unless you start with -server.

  9. promag commented at 9:23 PM on December 15, 2019: member

    The folllowing still hangs:

    • bitcoin-qt -regtest -server
    • open gui console
    • run waitfornewblock
    • try to quit

    Are you able to reproduce?

  10. hebasto commented at 8:06 AM on December 16, 2019: member

    @promag

    The folllowing still hangs:

    * `bitcoin-qt -regtest -server`
    
    * open gui console
    
    * run `waitfornewblock`
    
    * try to quit

    This requires a forced interruption of the RPC thread. It seems a bit out of the scope of this PR, as it solves the blocking of the GUI thread only.

    In your example bitcoin-qt literally "waits for new block", which is unreachable in regtest after quit is initiated ;) But this PR works on mainnet and testnet: bitcoin-qt quits just after a new block arrives.

    Maybe, to mention in OP that #17495 is fixed, is wrong, no?

  11. promag commented at 1:01 AM on February 3, 2020: member

    @hebasto maybe just mention it's not a complete fix.

  12. DrahtBot cross-referenced this on Feb 11, 2020 from issue WIP: Qt: add QML based mobile GUI by icota
  13. DrahtBot cross-referenced this on Feb 11, 2020 from issue qt: Add privacy to the Overview page by hebasto
  14. DrahtBot cross-referenced this on Feb 11, 2020 from issue gui: Bilingual GUI error messages by hebasto
  15. hebasto commented at 6:49 PM on March 27, 2020: member

    @promag

    @hebasto maybe just mention it's not a complete fix.

    The mention about the fix of #17495 has been removed from PR description.

    The actual fix of #17495 is #18452 ;)

  16. DrahtBot cross-referenced this on Mar 27, 2020 from issue rpc: Fix gui shutdown when waitfor* cmds are called from RPC console by hebasto
  17. DrahtBot added the label Needs rebase on May 8, 2020
  18. hebasto force-pushed on May 9, 2020
  19. hebasto commented at 4:15 AM on May 9, 2020: member

    Rebased 485e3dea08d291f1b32ba94e09ee793440f4daec -> e7ee445b9191d37505c8711115c5ef85c86ba31f (pr17659.01 -> pr17659.02) due to the conflict with #16224.

  20. DrahtBot removed the label Needs rebase on May 9, 2020
  21. DrahtBot cross-referenced this on May 19, 2020 from issue Reduce cs_main lock accumulation during GUI startup by jonasschnelli
  22. hebasto cross-referenced this on May 23, 2020 from issue rpc: Make gettxoutsetinfo/GetUTXOStats interruptible by MarcoFalke
  23. MarcoFalke commented at 11:40 AM on May 23, 2020: member

    Nice. Concept ACK

  24. MarcoFalke cross-referenced this on May 23, 2020 from issue [GUI] QT shutdown is blocked if called before gettxoutsetinfo is finished by ghost
  25. DrahtBot added the label Needs rebase on May 29, 2020
  26. jonasschnelli commented at 8:15 AM on May 29, 2020: contributor

    Concept ACK. Needs rebase.

  27. hebasto force-pushed on May 29, 2020
  28. hebasto commented at 9:34 AM on May 29, 2020: member

    Rebased e7ee445b9191d37505c8711115c5ef85c86ba31f -> 776d15763ea1551d7a5a86be29cfcd125d173d9d (pr17659.02 -> pr17659.03) due to the conflict with #16432.

  29. DrahtBot removed the label Needs rebase on May 29, 2020
  30. hebasto cross-referenced this on Jun 18, 2020 from issue gui: Fix regression in *txoutset* in GUI console by hebasto
  31. DrahtBot cross-referenced this on Jul 7, 2020 from issue multiprocess: Add bitcoin-gui -ipcconnect option by ryanofsky
  32. DrahtBot added the label Needs rebase on Aug 13, 2020
  33. qt: Add BitcoinGUI::clearGUI() ef23d25d6d
  34. qt: Use BitcoinGUI::clearGUI() e0b15a0816
  35. qt: Make requestShutdown() a slot e2d0fc815f
  36. qt: Factor out requestNodeShutdown() slot 9495d26b2e
  37. qt: Do not block GUI thread in RPCConsole 47912c505e
  38. hebasto force-pushed on Aug 13, 2020
  39. hebasto commented at 2:41 PM on August 13, 2020: member

    Rebased 776d15763ea1551d7a5a86be29cfcd125d173d9d -> 47912c505eebc79c849cf14fcf9d2654caa0945a (pr17659.03 -> pr17659.04) due to the conflict with #19011.

  40. DrahtBot removed the label Needs rebase on Aug 13, 2020
  41. fanquake commented at 6:51 AM on August 14, 2020: member

    Lets move this over to the GUI repo. I've also ported the original issue there now as well, given that the non-gui part has been fixed.

  42. fanquake closed this on Aug 14, 2020

  43. hebasto cross-referenced this on Aug 14, 2020 from issue Do not block GUI thread in RPCConsole by hebasto
  44. hebasto deleted the branch on Aug 14, 2020
  45. hebasto commented at 10:41 AM on August 14, 2020: member
  46. bitcoin locked this on Feb 15, 2022

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-05-20 06:54 UTC