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

Always return true if AppInitMain got to the end #11831

Merged

Conversation

TheBlueMatt
Copy link
Contributor

This should fix a rare zapwallettxes failure on travis, but also
avoids having init operations (re-adding wallet transactions to
mempool) running after RPC is free'd.

I believe this was the failure at https://travis-ci.org/bitcoin/bitcoin/jobs/311747844 (from #11605).

This should fix a very rare travis failure in zapwallettxes, but
is also more correct, as you can currently race
ReacceptWalletTransactions with stop RPC calls to get bitcoind to
(IMO) eroneously return a non-0 exit code.
Copy link
Member

@promag promag left a comment

Choose a reason for hiding this comment

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

ACK 07c4838.

Shutdown is handled after AppInitMain(). If the initialisation succeeded or not shouldn't depend on fRequestShutdown.

@meshcollider
Copy link
Contributor

utACK 07c4838

@sipa
Copy link
Member

sipa commented Dec 6, 2017

utACK 07c4838

@laanwj
Copy link
Member

laanwj commented Dec 6, 2017

If the initialisation succeeded or not shouldn't depend on fRequestShutdown.

"Terminated during initialization" is a valid reason for initialization to fail. The reason for returning false here is that initialization didn't fully finish, which is used in the GUI code to (not) spin up other things.

@promag
Copy link
Member

promag commented Dec 6, 2017

Yes but only if something was interrupted in the initialisation, that's not the case here, where everything was initialised.

@laanwj
Copy link
Member

laanwj commented Dec 6, 2017

Yes but only if something was interrupted in the initialisation, that's not the case here, where everything was initialised.

So in the case something was actually interrupted, it still early-outs with false? Then this change is fine with me.

@TheBlueMatt
Copy link
Contributor Author

Indeed, if initialization did not finish because of fRequestShutdown, false is returned after block index loading fails to complete.

@laanwj laanwj merged commit 07c4838 into bitcoin:master Dec 12, 2017
laanwj added a commit that referenced this pull request Dec 12, 2017
07c4838 Always return true if AppInitMain got to the end (Matt Corallo)

Pull request description:

  This should fix a rare zapwallettxes failure on travis, but also
  avoids having init operations (re-adding wallet transactions to
  mempool) running after RPC is free'd.

  I believe this was the failure at https://travis-ci.org/bitcoin/bitcoin/jobs/311747844 (from #11605).

Tree-SHA512: f0fea8c1b9265e2eeda57043d541380a3e58e4d9388fa24628a52fd56324257fcd7df0ca02e8f77f66fadd68d951893bab0f610ed9fd0a89b2ccd6bad1efa351
laanwj added a commit that referenced this pull request Feb 8, 2018
2222bf0 qt: Poll ShutdownTimer after init is done (MarcoFalke)

Pull request description:

  The shutdown process has started in `requestShutdown`, but initialize will happily continue with `initializeResult` and start threads late in the shutdown progess. Deleting this running thread will crash the application according to the qt docs:
  https://github.com/qt/qtbase/blob/e5033a5c9b769815112e922d0b224af860afd219/src/corelib/thread/qthread.cpp#L412-L415

  Potential fix for #12372 (comment)

  This reverts #11831 for now and hopefully restores the previous behaviour.

Tree-SHA512: 8e1706afe90ddf2d972aca12c12d4cb2a9a4f38646c59c5466fe5a1a67361896b93c43917d5ac283841ee2bcc62e6bb8dc2bc81dea9129c899b354e9a4ef241b
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jun 25, 2019
07c4838 Always return true if AppInitMain got to the end (Matt Corallo)

Pull request description:

  This should fix a rare zapwallettxes failure on travis, but also
  avoids having init operations (re-adding wallet transactions to
  mempool) running after RPC is free'd.

  I believe this was the failure at https://travis-ci.org/bitcoin/bitcoin/jobs/311747844 (from bitcoin#11605).

Tree-SHA512: f0fea8c1b9265e2eeda57043d541380a3e58e4d9388fa24628a52fd56324257fcd7df0ca02e8f77f66fadd68d951893bab0f610ed9fd0a89b2ccd6bad1efa351
barrystyle pushed a commit to PACGlobalOfficial/PAC that referenced this pull request Jan 22, 2020
07c4838 Always return true if AppInitMain got to the end (Matt Corallo)

Pull request description:

  This should fix a rare zapwallettxes failure on travis, but also
  avoids having init operations (re-adding wallet transactions to
  mempool) running after RPC is free'd.

  I believe this was the failure at https://travis-ci.org/bitcoin/bitcoin/jobs/311747844 (from bitcoin#11605).

Tree-SHA512: f0fea8c1b9265e2eeda57043d541380a3e58e4d9388fa24628a52fd56324257fcd7df0ca02e8f77f66fadd68d951893bab0f610ed9fd0a89b2ccd6bad1efa351
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Feb 13, 2020
07c4838 Always return true if AppInitMain got to the end (Matt Corallo)

Pull request description:

  This should fix a rare zapwallettxes failure on travis, but also
  avoids having init operations (re-adding wallet transactions to
  mempool) running after RPC is free'd.

  I believe this was the failure at https://travis-ci.org/bitcoin/bitcoin/jobs/311747844 (from bitcoin#11605).

Tree-SHA512: f0fea8c1b9265e2eeda57043d541380a3e58e4d9388fa24628a52fd56324257fcd7df0ca02e8f77f66fadd68d951893bab0f610ed9fd0a89b2ccd6bad1efa351
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Feb 27, 2020
07c4838 Always return true if AppInitMain got to the end (Matt Corallo)

Pull request description:

  This should fix a rare zapwallettxes failure on travis, but also
  avoids having init operations (re-adding wallet transactions to
  mempool) running after RPC is free'd.

  I believe this was the failure at https://travis-ci.org/bitcoin/bitcoin/jobs/311747844 (from bitcoin#11605).

Tree-SHA512: f0fea8c1b9265e2eeda57043d541380a3e58e4d9388fa24628a52fd56324257fcd7df0ca02e8f77f66fadd68d951893bab0f610ed9fd0a89b2ccd6bad1efa351
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Feb 27, 2020
07c4838 Always return true if AppInitMain got to the end (Matt Corallo)

Pull request description:

  This should fix a rare zapwallettxes failure on travis, but also
  avoids having init operations (re-adding wallet transactions to
  mempool) running after RPC is free'd.

  I believe this was the failure at https://travis-ci.org/bitcoin/bitcoin/jobs/311747844 (from bitcoin#11605).

Tree-SHA512: f0fea8c1b9265e2eeda57043d541380a3e58e4d9388fa24628a52fd56324257fcd7df0ca02e8f77f66fadd68d951893bab0f610ed9fd0a89b2ccd6bad1efa351
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Mar 14, 2020
2222bf0 qt: Poll ShutdownTimer after init is done (MarcoFalke)

Pull request description:

  The shutdown process has started in `requestShutdown`, but initialize will happily continue with `initializeResult` and start threads late in the shutdown progess. Deleting this running thread will crash the application according to the qt docs:
  https://github.com/qt/qtbase/blob/e5033a5c9b769815112e922d0b224af860afd219/src/corelib/thread/qthread.cpp#L412-L415

  Potential fix for bitcoin#12372 (comment)

  This reverts bitcoin#11831 for now and hopefully restores the previous behaviour.

Tree-SHA512: 8e1706afe90ddf2d972aca12c12d4cb2a9a4f38646c59c5466fe5a1a67361896b93c43917d5ac283841ee2bcc62e6bb8dc2bc81dea9129c899b354e9a4ef241b
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Mar 14, 2020
2222bf0 qt: Poll ShutdownTimer after init is done (MarcoFalke)

Pull request description:

  The shutdown process has started in `requestShutdown`, but initialize will happily continue with `initializeResult` and start threads late in the shutdown progess. Deleting this running thread will crash the application according to the qt docs:
  https://github.com/qt/qtbase/blob/e5033a5c9b769815112e922d0b224af860afd219/src/corelib/thread/qthread.cpp#L412-L415

  Potential fix for bitcoin#12372 (comment)

  This reverts bitcoin#11831 for now and hopefully restores the previous behaviour.

Tree-SHA512: 8e1706afe90ddf2d972aca12c12d4cb2a9a4f38646c59c5466fe5a1a67361896b93c43917d5ac283841ee2bcc62e6bb8dc2bc81dea9129c899b354e9a4ef241b
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Mar 15, 2020
2222bf0 qt: Poll ShutdownTimer after init is done (MarcoFalke)

Pull request description:

  The shutdown process has started in `requestShutdown`, but initialize will happily continue with `initializeResult` and start threads late in the shutdown progess. Deleting this running thread will crash the application according to the qt docs:
  https://github.com/qt/qtbase/blob/e5033a5c9b769815112e922d0b224af860afd219/src/corelib/thread/qthread.cpp#L412-L415

  Potential fix for bitcoin#12372 (comment)

  This reverts bitcoin#11831 for now and hopefully restores the previous behaviour.

Tree-SHA512: 8e1706afe90ddf2d972aca12c12d4cb2a9a4f38646c59c5466fe5a1a67361896b93c43917d5ac283841ee2bcc62e6bb8dc2bc81dea9129c899b354e9a4ef241b
random-zebra added a commit to PIVX-Project/PIVX that referenced this pull request Feb 21, 2021
aab15d7 ReplayBlocks: use find instead of brackets operator to access to the element. (furszy)
e898353 [Refactoring] Use const CBlockIndex* where appropriate (random-zebra)
c76fa04 qa: Extract rpc_timewait as test param (furszy)
0f832e3 shutdown: Stop threads before resetting ptrs (MarcoFalke)
67aebbf http: Remove numThreads and ThreadCounter (Wladimir J. van der Laan)
e24c710 http: Remove WaitExit from WorkQueue (Wladimir J. van der Laan)
b8f7364 http: Join worker threads before deleting work queue (Wladimir J. van der Laan)
7d68769 rpc: further constrain the libevent workaround (Cory Fields)
75af065 rpc: work-around an upstream libevent bug (Cory Fields)
50e5833 Always return true if AppInitMain got to the end (Matt Corallo)
bd70dcc [qa] Test non-atomic chainstate writes (furszy)
8f04970 Dont create pcoinsTip until after ReplayBlocks. (Matt Corallo)
93f2b15 Random db flush crash simulator (Pieter Wuille)
72f3b17 Adapt memory usage estimation for flushing (Pieter Wuille)
8540113 Non-atomic flushing using the blockchain as replay journal (Pieter Wuille)
8d6625f [MOVEONLY] Move LastCommonAncestor to chain (Pieter Wuille)

Pull request description:

  > This patch adds an extra "head blocks" to the chainstate, which gives the range of blocks for writes may be incomplete. At the start of a flush, we write this record, write the dirty dbcache entries in 16 MiB batches, and at the end we remove the heads record again. If it is present at startup it means we crashed during flush, and we rollback/roll forward blocks inside of it to get a consistent tip on disk before proceeding.

  > If a flush completes succesfully, the resulting database is compatible with previous versions. If the node crashes in the middle of a flush, a version of the code with this patch is needed to recovery.

  An adaptation of the following PRs with further modifications to the `feature_dbcrash.py` test to be up-to-date with upstream and solve RPC related bugs.

  * bitcoin#10148.
  * Increase RPC wait time.
  * bitcoin#11831
  * bitcoin#11593
  * bitcoin#12366
  * bitcoin#13837
  * bitcoin#13894

ACKs for top commit:
  random-zebra:
    ACK aab15d7
  Fuzzbawls:
    ACK aab15d7

Tree-SHA512: 898806746f581a9eb8deb0155c558481abf4454c6f3b3c3ad505c557938d0700fe9796e98e36492286ae869378647072c3ad77ad65e9dd7075108ff96469ade1
@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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants