From 1a6c4e5c62b084f68edb17767e629dad46416eda Mon Sep 17 00:00:00 2001 From: Clebert Suconic Date: Fri, 17 Jan 2020 11:06:10 -0500 Subject: [PATCH] ARTEMIS-2603 Deadlock between pageStore.getCurrentID and page.cleanup This happened when JournalStorageManager.startReplication and PageStore.cleanup were called between multiple threads. --- .../activemq/artemis/core/paging/impl/PagingStoreImpl.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/impl/PagingStoreImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/impl/PagingStoreImpl.java index 452be16e73..341ee7c792 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/impl/PagingStoreImpl.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/impl/PagingStoreImpl.java @@ -1169,7 +1169,7 @@ public class PagingStoreImpl implements PagingStore { @Override public Collection getCurrentIds() throws Exception { - lock.writeLock().lock(); + lock.readLock().lock(); try { List ids = new ArrayList<>(); SequentialFileFactory factory = fileFactory; @@ -1180,7 +1180,7 @@ public class PagingStoreImpl implements PagingStore { } return ids; } finally { - lock.writeLock().unlock(); + lock.readLock().unlock(); } }