From 12576d77058f170fc3afbddf39e296c7e6302760 Mon Sep 17 00:00:00 2001 From: Fabio Di Fabio Date: Fri, 16 Aug 2024 22:06:53 +0200 Subject: [PATCH] Correctly release txpool save and restore lock in case of exceptions (#7473) Signed-off-by: Fabio Di Fabio --- CHANGELOG.md | 1 + .../besu/ethereum/eth/transactions/TransactionPool.java | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 183ca24e55..84641ea16e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,6 +26,7 @@ - Fix protocol schedule check for devnets [#7429](https://github.com/hyperledger/besu/pull/7429) - Fix behaviour when starting in a pre-merge network [#7431](https://github.com/hyperledger/besu/pull/7431) - Fix tracing in precompiled contracts when halting for out of gas [#7318](https://github.com/hyperledger/besu/issues/7318) +- Correctly release txpool save and restore lock in case of exceptions [#7473](https://github.com/hyperledger/besu/pull/7473) ## 24.7.1 diff --git a/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/transactions/TransactionPool.java b/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/transactions/TransactionPool.java index c069a771eb..6bb2029960 100644 --- a/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/transactions/TransactionPool.java +++ b/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/transactions/TransactionPool.java @@ -706,7 +706,8 @@ public class TransactionPool implements BlockAddedObserver { isCancelled.set(false); operationInProgress.set( - CompletableFuture.runAsync(operation).thenRun(diskAccessLock::release)); + CompletableFuture.runAsync(operation) + .whenComplete((res, err) -> diskAccessLock.release())); return operationInProgress.get(); } else { CompletableFuture.failedFuture(