Fix Multi-Nodes tests + Clean unwinding process - #37
Open
CryptoPascal31 wants to merge 10 commits into
Open
Conversation
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.
The objective of this PR is to make Multi Nodes tests 100% reliable.
Sanitizing the node itself:
Better control on the CutDB stop process. The PQueue was modified to manage an optional EOF flag. As such, CutDB pipeline is now always stopped by the Pqueue in a safe and known position. Avoiding risks of stopping in the middle of processing, leading it to an undetermined state.
Miner resources (Mining coordinator). No clean mechanism was intended to unwind it naturally. Only an AsyncException could stop it. This was improved by replacing runConcurently by withAsync.
Sanitizing the test routines:
MOST IMPORTANT POINT: When running nodes for seconds, Timeout is applied on the inner function only not on the whole node. Letting the node to "unwind its resources by itself" in a safe order avoiding instabilities an dependencies issues.
There was a bug during multi-node "replay only"... Except the first node, all nodes were awaiting on the bootstrapPortVar MVar.. This was not the expected behavior. This bugs was silent because the "replay only" was only tested on the first node, and then everything cancelled.
When taking snapshot if the current Cut state, we stop the CutDb early. This make the test then 100% reliable, and addresses the "Flaky concern" (see old comments).
Note:
But this has the advantage of keeping things simple, and then being handled correctly by runForever util function, which excpect an AysncException to not restart automatically the loop.