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

Fix "Backward sync stuck in a loop" #6749 #6756

Merged
merged 10 commits into from
Mar 22, 2024
Merged

Fix "Backward sync stuck in a loop" #6749 #6756

merged 10 commits into from
Mar 22, 2024

Conversation

pinges
Copy link
Contributor

@pinges pinges commented Mar 19, 2024

PR description

This PR is fixing issue #6749, trying to make minimal changes to the existing implementation.

pinges added 2 commits March 19, 2024 18:05
Signed-off-by: stefan.pingel@consensys.net <stefan.pingel@consensys.net>
@pinges pinges requested review from garyschulte and matkt March 19, 2024 08:14
final CompletableFuture<Void> secondFuture =
context.syncBackwardsUntil(getBlockByNumber(REMOTE_HEIGHT - 1).getHash());
respondUntilFutureIsDone(secondFuture);
secondFuture.get();
Copy link
Contributor

Choose a reason for hiding this comment

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

is there any useful assertion to make at this point? or just that it didn't error out

Copy link
Contributor

Choose a reason for hiding this comment

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

it's still in dev, will tidy up this test now I know it works for the impl

Copy link
Contributor

Choose a reason for hiding this comment

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

Done

Signed-off-by: stefan.pingel@consensys.net <stefan.pingel@consensys.net>
@@ -14,3 +14,4 @@ org.gradle.jvmargs=-Xmx4g \
--add-opens jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED
# Could be moved to sonar properties after https://sonarsource.atlassian.net/browse/SONARGRADL-134
systemProp.sonar.gradle.skipCompile=true
version=24.3.1-SNAPSHOT
Copy link
Contributor

Choose a reason for hiding this comment

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

we removed version from gradle.properties intentionally. Is this an errant add?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I had to add it to be able to use the Jenkins build from source. Sally found that problem in the scripts and I think it should get fixed soon. Once that is done I can get rid of it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

removed

Copy link
Contributor

Choose a reason for hiding this comment

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

this doesn't look removed... ?

Copy link
Contributor

@garyschulte garyschulte left a comment

Choose a reason for hiding this comment

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

Good 'light touch' approach. good to merge once those two minor issues are resolved

Comment on lines 73 to 74
// context.getEthContext().getEthPeers().peerCount() >
// (context.getEthContext().getEthPeers().getMaxPeers() / 2)
Copy link
Contributor

Choose a reason for hiding this comment

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

it probably is wise to at least assert we have peers before we drop hashes, but making a qualitative judgement about the peers, when all we have to go by is a hash, is not straightforward.

IMO dropping the hash is straightforward and not catastrophic, since we will get a subsequent fcU. As long as we do not give up either:

  • too easily
  • in the absence of peers

I think a simple peer count check with a task retry backoff will suffice 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We do know that we have at least one peer, otherwise we would not get the max retries exception.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Even if we do remove a hash from the list that is on the chain, the BWS still works.

siladu added 3 commits March 20, 2024 16:36
Signed-off-by: Simon Dudley <simon.dudley@consensys.net>
Signed-off-by: Simon Dudley <simon.dudley@consensys.net>
Signed-off-by: Simon Dudley <simon.dudley@consensys.net>
@@ -83,7 +83,7 @@ public class BackwardSyncContextTest {
public static final int REMOTE_HEIGHT = 50;
public static final int UNCLE_HEIGHT = 25 - 3;

public static final int NUM_OF_RETRIES = 100;
public static final int NUM_OF_RETRIES = 1;
Copy link
Contributor

Choose a reason for hiding this comment

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

only one retry ? in case of bad peers it will not be a problem? not sure how backwardsync is working so just asking

Copy link
Contributor

Choose a reason for hiding this comment

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

This is test code, prod code has 2 retries (which is actually just one retry: two "tries")

pinges added 3 commits March 22, 2024 15:56
…s from source with Jenkins

Signed-off-by: stefan.pingel@consensys.net <stefan.pingel@consensys.net>
Signed-off-by: stefan.pingel@consensys.net <stefan.pingel@consensys.net>
@pinges pinges marked this pull request as ready for review March 22, 2024 12:30
@pinges pinges requested a review from garyschulte March 22, 2024 12:30
Copy link
Contributor

@garyschulte garyschulte left a comment

Choose a reason for hiding this comment

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

LGTM, non-blocking feedback

@@ -14,3 +14,4 @@ org.gradle.jvmargs=-Xmx4g \
--add-opens jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED
# Could be moved to sonar properties after https://sonarsource.atlassian.net/browse/SONARGRADL-134
systemProp.sonar.gradle.skipCompile=true
version=24.3.1-SNAPSHOT
Copy link
Contributor

Choose a reason for hiding this comment

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

this doesn't look removed... ?

@@ -438,4 +441,53 @@ public void shouldFailAfterMaxNumberOfRetries() {
}
}
}

@SuppressWarnings("BannedMethod")
Copy link
Contributor

Choose a reason for hiding this comment

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

what is the banned method? a comment might help here and on the other suppresswarnings statement

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Had to add the version back in so I can use the Jankins build from source. Will fix it :-)

Signed-off-by: stefan.pingel@consensys.net <stefan.pingel@consensys.net>
@pinges pinges merged commit 42f4748 into hyperledger:main Mar 22, 2024
42 checks passed
jflo pushed a commit to jflo/besu that referenced this pull request Mar 26, 2024
* minimal change to fix BWS

Signed-off-by: stefan.pingel@consensys.net <stefan.pingel@consensys.net>
Signed-off-by: Simon Dudley <simon.dudley@consensys.net>
Co-authored-by: Simon Dudley <simon.dudley@consensys.net>
Signed-off-by: Justin Florentine <justin+github@florentine.us>
amsmota pushed a commit to Citi/besu that referenced this pull request Apr 16, 2024
* minimal change to fix BWS

Signed-off-by: stefan.pingel@consensys.net <stefan.pingel@consensys.net>
Signed-off-by: Simon Dudley <simon.dudley@consensys.net>
Co-authored-by: Simon Dudley <simon.dudley@consensys.net>
Signed-off-by: amsmota <antonio.mota@citi.com>
amsmota pushed a commit to Citi/besu that referenced this pull request Apr 16, 2024
* minimal change to fix BWS

Signed-off-by: stefan.pingel@consensys.net <stefan.pingel@consensys.net>
Signed-off-by: Simon Dudley <simon.dudley@consensys.net>
Co-authored-by: Simon Dudley <simon.dudley@consensys.net>
Signed-off-by: amsmota <antonio.mota@citi.com>
matthew1001 pushed a commit to kaleido-io/besu that referenced this pull request Jun 7, 2024
* minimal change to fix BWS

Signed-off-by: stefan.pingel@consensys.net <stefan.pingel@consensys.net>
Signed-off-by: Simon Dudley <simon.dudley@consensys.net>
Co-authored-by: Simon Dudley <simon.dudley@consensys.net>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants