Use non-atomic flushing with block replay#2207
Merged
random-zebra merged 16 commits intoPIVX-Project:masterfrom Feb 21, 2021
Merged
Use non-atomic flushing with block replay#2207random-zebra merged 16 commits intoPIVX-Project:masterfrom
random-zebra merged 16 commits intoPIVX-Project:masterfrom
Conversation
This requires that we not access pcoinsTip in InitBlockIndex's FlushStateToDisk (so we just skip it until later in AppInitMain) and the LoadChainTip in LoadBlockIndex (which there is already one later in AppinitMain, after ReplayBlocks, so skipping it there is fine). Includes some simplifications by Suhas Daftuar and Pieter Wuille.
b392971 to
be3da45
Compare
>>> Adaptation of btc@176c021d085f5a45bc9e038e760942aa648dd797 up to the present.
Adds new functional test, dbcrash.py, which uses -dbcrashratio to exercise the
logic for recovering from a crash during chainstate flush.
dbcrash.py is added to the extended tests, as it may take ~10 minutes to run
Use _Exit() instead of exit() for crash simulation
This eliminates stderr output such as:
terminate called without an active exception
or
Assertion failed: (!pthread_mutex_destroy(&m)), function ~recursive_mutex, file /usr/local/include/boost/thread/pthread/recursive_mutex.hpp, line 104.
Eliminating the stderr output on crash simulation allows testing with
test_runner.py, which reports a test as failed if stderr is produced.
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.
A rare race condition may trigger while awaiting the body of a message, see upsteam commit 5ff8eb26371c4dc56f384b2de35bea2d87814779 for details. This may fix some reported rpc hangs/crashes.
The bug was introduced in 2.1.6-beta, versions before that don't need the workaround.
This prevents a potential race condition if control flow ends up in `ShutdownHTTPServer` before the thread gets to `queue->Run()`, deleting the work queue while workers are still going to use it. Meant to fix bitcoin#12362. Signed-off-by: Wladimir J. van der Laan <[email protected]>
This function, which waits for all threads to exit, is no longer needed now that threads are joined instead. Signed-off-by: Wladimir J. van der Laan <[email protected]>
The HTTP worker thread counter, as well as the RAII object that was used to maintain it, is unused now, so can be removed. Signed-off-by: Wladimir J. van der Laan <[email protected]>
Adaptation from btc@fa5b440971a0dfdd64c1b86748a573fcd7dc65d3
be3da45 to
c76fa04
Compare
Author
|
Added two more commits solving the RPC timeout, GA should be good now. Ready for review. |
random-zebra
left a comment
There was a problem hiding this comment.
Good stuff. Code review ACK with some points.
Author
|
Done @random-zebra, commit cherry-picked. |
45aa5b7 to
aab15d7
Compare
Fuzzbawls
approved these changes
Feb 21, 2021
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
An adaptation of the following PRs with further modifications to the
feature_dbcrash.pytest to be up-to-date with upstream and solve RPC related bugs.