besu
besu copied to clipboard
More graceful error handling for backwards sync step transition to forward sync
Description
As a user, I want better error handling in the backwards sync step so that my logs are not spammed. When transitioning from backwards sync to a full sync, the logging is often noisy with a full stack trace in the case of 0 peers.
Acceptance Criteria
- No stack trace and better handling.
Steps to Reproduce (Bug)
- Initiate a backwards sync on the execution layer.
- Have it transition to the forward sync step with no peers.
- Look at logs.
Expected behavior:
Graceful handling of this backwards synced exceptions (currently uncaught exception and stack trace).
Actual behavior:
The below exception repeats until peers are found.
2022-08-16 12:49:37.949-04:00 | EthScheduler-Timer-0 | INFO | BackwardsSyncAlgorithm | Backward sync reached ancestor header, starting Forward sync
2022-08-16 12:49:37.950-04:00 | ForkJoinPool.commonPool-worker-3 | WARN | BackwardSyncContext | There was an uncaught exception during Backwards Sync. Retrying in 5000 milliseconds...
java.util.concurrent.CompletionException: org.hyperledger.besu.ethereum.eth.manager.exceptions.NoAvailablePeersException: Task failed: NO_AVAILABLE_PEERS
at java.base/java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:332)
at java.base/java.util.concurrent.CompletableFuture.uniApplyNow(CompletableFuture.java:674)
at java.base/java.util.concurrent.CompletableFuture.uniApplyStage(CompletableFuture.java:662)
at java.base/java.util.concurrent.CompletableFuture.thenApply(CompletableFuture.java:2168)
at org.hyperledger.besu.ethereum.eth.sync.backwardsync.ForwardSyncStep.requestBodies(ForwardSyncStep.java:78)
at org.hyperledger.besu.ethereum.eth.sync.backwardsync.ForwardSyncStep.possibleRequestBodies(ForwardSyncStep.java:63)
at java.base/java.util.concurrent.CompletableFuture$UniCompose.tryFire(CompletableFuture.java:1150)
at java.base/java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:510)
at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1773)
at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.exec(CompletableFuture.java:1760)
at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373)
at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1182)
at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1655)
at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1622)
at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165)
Caused by: org.hyperledger.besu.ethereum.eth.manager.exceptions.NoAvailablePeersException: Task failed: NO_AVAILABLE_PEERS
at org.hyperledger.besu.ethereum.eth.manager.PendingPeerRequest.attemptExecution(PendingPeerRequest.java:58)
at org.hyperledger.besu.ethereum.eth.manager.EthPeers.executePeerRequest(EthPeers.java:148)
at org.hyperledger.besu.ethereum.eth.manager.task.AbstractPeerRequestTask.sendRequestToPeer(AbstractPeerRequestTask.java:94)
at org.hyperledger.besu.ethereum.eth.manager.task.AbstractPeerRequestTask.sendRequestToPeer(AbstractPeerRequestTask.java:89)
at org.hyperledger.besu.ethereum.eth.manager.task.GetBodiesFromPeerTask.sendRequest(GetBodiesFromPeerTask.java:86)
at org.hyperledger.besu.ethereum.eth.manager.task.AbstractPeerRequestTask.executeTask(AbstractPeerRequestTask.java:59)
at org.hyperledger.besu.ethereum.eth.manager.task.AbstractEthTask.executeTaskTimed(AbstractEthTask.java:150)
at org.hyperledger.besu.ethereum.eth.manager.task.AbstractEthTask.run(AbstractEthTask.java:75)
at org.hyperledger.besu.ethereum.eth.sync.backwardsync.ForwardSyncStep.requestBodies(ForwardSyncStep.java:77)
... 10 more
Frequency: [What percentage of the time does it occur?]
Indefinitely until peers are found.
Versions (Add all that apply)
- Software version: 22.7.0
- Java version: 17
- OS Name & Version: All