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

Create backward sync retries on demand #4095

Merged
merged 7 commits into from
Jul 15, 2022

Conversation

fab-10
Copy link
Contributor

@fab-10 fab-10 commented Jul 13, 2022

Signed-off-by: Fabio Di Fabio fabio.difabio@consensys.net

PR description

Currently backward sync create the max number of retries ahead of time, and this could cause unneeded retries in case of non recoverable error like in this log
backward-sync-retries.txt

This PR rework the retry strategy to create retries on demand and fast fail in case of a non recoverable exception.

Fixed Issue(s)

Documentation

  • I thought about documentation and added the doc-change-required label to this PR if
    updates are required.

Changelog

@fab-10 fab-10 force-pushed the backwardsync-ondemand-retries branch 2 times, most recently from 3114b6b to 9442dde Compare July 13, 2022 12:34
Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
@fab-10 fab-10 force-pushed the backwardsync-ondemand-retries branch from 9442dde to b54ddfb Compare July 13, 2022 12:35
@fab-10 fab-10 added the mainnet label Jul 13, 2022
Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
@fab-10 fab-10 marked this pull request as ready for review July 13, 2022 13:59
return ethContext
.getScheduler()
.scheduleFutureTask(
() -> prepareBackwardSyncFutureWithRetry(retries - 1), Duration.ofSeconds(5));
Copy link
Contributor

Choose a reason for hiding this comment

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

Are you convinced this will not stackoverflow?

Copy link
Contributor Author

@fab-10 fab-10 Jul 13, 2022

Choose a reason for hiding this comment

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

the method is called with an always decreasing number of remaining retries, and when that number reaches 0 the recursion is stopped, so it should not do an infinite recursion, and MAX_RETRIES is a small number that should not produce a stack overflow, am I missing some specific cases?

I am adding unit test to check that this not goes on stackoverflow.

I suggest also to reduce the MAX_RETRIES to something like 20, so it retries for 20*5sec = 2minutes, what do you think?

Copy link
Contributor

Choose a reason for hiding this comment

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

I just know that retries using recursion and futures are tricky because of stack overflow. I am fine with reducing the retries amount.

@fab-10 fab-10 marked this pull request as draft July 13, 2022 16:25
@fab-10
Copy link
Contributor Author

fab-10 commented Jul 13, 2022

converting to draft until unit tests are ready

Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
@fab-10 fab-10 force-pushed the backwardsync-ondemand-retries branch from b0a6a57 to 1a18de7 Compare July 14, 2022 16:23
# Conflicts:
#	CHANGELOG.md
#	ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/sync/backwardsync/BackwardSyncContext.java
@fab-10 fab-10 marked this pull request as ready for review July 14, 2022 16:58
@daniellehrner daniellehrner enabled auto-merge (squash) July 15, 2022 08:45
@daniellehrner daniellehrner merged commit 45ce87e into hyperledger:main Jul 15, 2022
codyborn pushed a commit to codyborn/besu that referenced this pull request Jul 31, 2022
* Create backward sync retries on demand

Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
codyborn pushed a commit to codyborn/besu that referenced this pull request Jul 31, 2022
* Create backward sync retries on demand

Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
Signed-off-by: Cody Born <codyborn@outlook.com>
@fab-10 fab-10 deleted the backwardsync-ondemand-retries branch November 8, 2022 13:29
eum602 pushed a commit to lacchain/besu that referenced this pull request Nov 3, 2023
* Create backward sync retries on demand

Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants