Skip to content

Conversation

@jonasschnelli
Copy link
Contributor

Introduced in #12783 / 1e0f3c4

Calling m_node.isInitialBlockDownload() during catch-up in the main GUI thread leads to locking the GUI for seconds,... which is avoidable since we fetch that information via a signal anyways.

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.

Concept ACK, just a question

@jonasschnelli jonasschnelli force-pushed the 2020/05/fix_macguilock branch from feecf49 to ec2c94f Compare May 18, 2020 14:56
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.

Code review ACK feecf490c418399e9771a5b48e078a4c2c5b6b55. It's good to avoid calls from gui->node in the middle of node->gui callbacks

EDIT: Updated ACK comment in light of fix from other PR #19007 (comment)

void setNetworkActive(bool networkActive);
/** Set number of blocks and last block date shown in the UI */
void setNumBlocks(int count, const QDateTime& blockDate, double nVerificationProgress, bool headers);
void setNumBlocks(int count, const QDateTime& blockDate, double nVerificationProgress, bool headers, bool initial_sync);
Copy link
Contributor

Choose a reason for hiding this comment

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

In commit "relax GUI locks: avoid unnecesarry calls to ::ChainstateActive().IsInitialBlockDownload()" (feecf490c418399e9771a5b48e078a4c2c5b6b55)

Could revert all these changes to rpcconsole.h and rpcconsole.cpp. Qt is fine with dropping ununused signal arguments https://doc.qt.io/qt-5/signalsandslots.html "a slot may have a shorter signature than the signal it receives"

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.

Code review ACK ec2c94f. Only change since last review was adding back two isInitialBlockDownload calls to reduce the scope of the PR a little

@ryanofsky
Copy link
Contributor

It turns out hebasto already implemented the same change in 7a2a5ed from #18152, and IMO that change is cleaner and preferable to this one. I've acked both PR's though, since I think they are both improvements.

@DrahtBot
Copy link
Contributor

DrahtBot commented May 19, 2020

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.

@jonasschnelli
Copy link
Contributor Author

Thanks @ryanofsky for the review and pointing to #18152. I agree that #18152 (which I wasn't aware) is the superior solution.

@DrahtBot
Copy link
Contributor

🐙 This pull request conflicts with the target branch and needs rebase.

@maflcko maflcko removed this from the 0.20.1 milestone May 19, 2020
@ryanofsky
Copy link
Contributor

I think this can be closed since OG alternative #18152 was merged

@maflcko maflcko closed this May 19, 2020
jonasschnelli added a commit that referenced this pull request Aug 13, 2020
386ec19 Reduce cs_main lock accumulation during GUI startup (Jonas Schnelli)
d42cb79 Optionally populate BlockAndHeaderTipInfo during AppInitMain (Jonas Schnelli)
b354a14 Add BlockAndHeaderTipInfo to the node interface/appInit (Jonas Schnelli)
25e1d0b RPCConsole, take initial chaintip data as parameter (Jonas Schnelli)

Pull request description:

  During the GUI startup, there is currently an accumulation of cs_main locks due to setting initial chain state values at multiple locations (in the GUI main thread).

  This PR tries to cache the initial chain state (tip height, tip time, best header, etc.) short after loading the blockindex.

  The cached values are then used instead of fetching them again (and thus locking `cs_main`) during setting the client model.

  This should fix the initial GUI blocking often experienced during or short after the splashscreen.
  On mac, best tested together with #19007.

ACKs for top commit:
  promag:
    Code review ACK 386ec19.
  ryanofsky:
    Code review ACK 386ec19. Just rebased since last review due to conflicts

Tree-SHA512: caccca05360e6dc0c3aade5e7ed24be513607821a8bd6612d0337259304ab772799fb2d707a0d7c7e50fbff4bd394354643fd0aeaa3bb55960ccc28562f4763d
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Aug 18, 2022
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