You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by cl...@apache.org on 2018/05/07 14:23:41 UTC

[1/2] activemq-artemis git commit: ARTEMIS-1852 PageCursorProvider is leaking cleanup tasks while stopping

Repository: activemq-artemis
Updated Branches:
  refs/heads/master 26ccd63b1 -> 88b1371e9


ARTEMIS-1852 PageCursorProvider is leaking cleanup tasks while stopping

PageCursorProviderImpl is not handling any pending cleanup tasks
on stop, leaving paging enabled due to the remaining pages to be
cleared up.
PagingStoreImpl is responsible to trigger the flushing of pending
tasks on PageCursorProviderImpl before stopping it and to try to
execute any remaining tasks on the owned common executor, before
shutting it down.
It fixes testTopicsWithNonDurableSubscription.


Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/d31d6e81
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/d31d6e81
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/d31d6e81

Branch: refs/heads/master
Commit: d31d6e81313e9b8bf4f8195254da10b4328d0e80
Parents: 26ccd63
Author: Francesco Nigro <ni...@gmail.com>
Authored: Mon May 7 11:47:26 2018 +0200
Committer: Francesco Nigro <ni...@gmail.com>
Committed: Mon May 7 15:28:45 2018 +0200

----------------------------------------------------------------------
 .../paging/cursor/impl/PageCursorProviderImpl.java  |  6 ++++--
 .../artemis/core/paging/impl/PagingStoreImpl.java   | 16 ++++++++++++++--
 2 files changed, 18 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/d31d6e81/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/cursor/impl/PageCursorProviderImpl.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/cursor/impl/PageCursorProviderImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/cursor/impl/PageCursorProviderImpl.java
index 2feb849..b814d9b 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/cursor/impl/PageCursorProviderImpl.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/cursor/impl/PageCursorProviderImpl.java
@@ -239,8 +239,10 @@ public class PageCursorProviderImpl implements PageCursorProvider {
       for (PageSubscription cursor : activeCursors.values()) {
          cursor.stop();
       }
-
-      executor.shutdownNow();
+      final int pendingCleanupTasks = scheduledCleanup.get();
+      if (pendingCleanupTasks > 0) {
+         logger.tracef("Stopping with %d cleanup tasks to be completed yet", pendingCleanupTasks);
+      }
    }
 
    private void waitForFuture() {

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/d31d6e81/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/impl/PagingStoreImpl.java
----------------------------------------------------------------------
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 0eec5a0..6a07ffc 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
@@ -348,11 +348,23 @@ public class PagingStoreImpl implements PagingStore {
    @Override
    public synchronized void stop() throws Exception {
       if (running) {
+         cursorProvider.flushExecutors();
          cursorProvider.stop();
 
-         running = false;
+         final List<Runnable> pendingTasks = new ArrayList<>();
+         final int pendingTasksWhileShuttingDown = executor.shutdownNow(pendingTasks::add);
+         if (pendingTasksWhileShuttingDown > 0) {
+            logger.tracef("Try executing %d pending tasks on stop", pendingTasksWhileShuttingDown);
+            for (Runnable pendingTask : pendingTasks) {
+               try {
+                  pendingTask.run();
+               } catch (Throwable t) {
+                  logger.warn("Error while executing a pending task on shutdown", t);
+               }
+            }
+         }
 
-         executor.shutdownNow();
+         running = false;
 
          if (currentPage != null) {
             currentPage.close(false);


[2/2] activemq-artemis git commit: This closes #2075

Posted by cl...@apache.org.
This closes #2075


Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/88b1371e
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/88b1371e
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/88b1371e

Branch: refs/heads/master
Commit: 88b1371e989e013f83f12af4a887b45a15aa0965
Parents: 26ccd63 d31d6e8
Author: Clebert Suconic <cl...@apache.org>
Authored: Mon May 7 10:23:36 2018 -0400
Committer: Clebert Suconic <cl...@apache.org>
Committed: Mon May 7 10:23:36 2018 -0400

----------------------------------------------------------------------
 .../paging/cursor/impl/PageCursorProviderImpl.java  |  6 ++++--
 .../artemis/core/paging/impl/PagingStoreImpl.java   | 16 ++++++++++++++--
 2 files changed, 18 insertions(+), 4 deletions(-)
----------------------------------------------------------------------