From 72a8409a49193755d6ffe0b4436631ab7d508146 Mon Sep 17 00:00:00 2001 From: Fabio Di Fabio Date: Fri, 16 Aug 2024 12:17:57 +0200 Subject: [PATCH] Correctly release txpool save and restore lock in case of exceptions 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 183ca24e550..84641ea16e1 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 c069a771eb2..6bb2029960a 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 @@ private CompletableFuture serializeAndDedupOperation( 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(