You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by jb...@apache.org on 2017/04/18 17:06:32 UTC

[2/6] activemq-artemis git commit: ARTEMIS-1117 Improving IO Failure resilience Part I

ARTEMIS-1117 Improving IO Failure resilience Part I

Me (Clebert) and Francesco worked independently here.
I am keeping Francesco's changes on a separate commit

https://issues.apache.org/jira/browse/ARTEMIS-1117


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

Branch: refs/heads/master
Commit: 23ba3e27d90b85240f7181b5d792848727fdf172
Parents: 7d5511c
Author: Francesco Nigro <ni...@gmail.com>
Authored: Thu Apr 13 17:48:00 2017 +0200
Committer: Clebert Suconic <cl...@apache.org>
Committed: Tue Apr 18 11:34:09 2017 -0400

----------------------------------------------------------------------
 .../artemis/core/io/aio/AIOSequentialFile.java  | 38 +++++++++++++++-----
 1 file changed, 29 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/23ba3e27/artemis-journal/src/main/java/org/apache/activemq/artemis/core/io/aio/AIOSequentialFile.java
----------------------------------------------------------------------
diff --git a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/io/aio/AIOSequentialFile.java b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/io/aio/AIOSequentialFile.java
index f641aec..9d3a824 100644
--- a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/io/aio/AIOSequentialFile.java
+++ b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/io/aio/AIOSequentialFile.java
@@ -18,6 +18,8 @@ package org.apache.activemq.artemis.core.io.aio;
 
 import java.io.File;
 import java.io.IOException;
+import java.lang.management.ManagementFactory;
+import java.lang.management.ThreadInfo;
 import java.nio.ByteBuffer;
 import java.util.PriorityQueue;
 import java.util.concurrent.Executor;
@@ -100,16 +102,34 @@ public class AIOSequentialFile extends AbstractSequentialFile {
 
       super.close();
 
-      if (!pendingCallbacks.await(10, TimeUnit.SECONDS)) {
-         factory.onIOError(new IOException("Timeout on close"), "Timeout on close", this);
-      }
-
-      opened = false;
-
-      timedBuffer = null;
+      final String fileName = this.getFileName();
+      try {
+         int waitCount = 0;
+         while (!pendingCallbacks.await(10, TimeUnit.SECONDS)) {
+            waitCount++;
+            if (waitCount == 1) {
+               final ThreadInfo[] threads = ManagementFactory.getThreadMXBean().dumpAllThreads(true, true);
+               for (ThreadInfo threadInfo : threads) {
+                  ActiveMQJournalLogger.LOGGER.warn(threadInfo.toString());
+               }
+               factory.onIOError(new IOException("Timeout on close"), "Timeout on close", this);
+            }
+            ActiveMQJournalLogger.LOGGER.warn("waiting pending callbacks on " + fileName + " from " + (waitCount * 10) + " seconds!");
+         }
+      } catch (InterruptedException e) {
+         ActiveMQJournalLogger.LOGGER.warn("interrupted while waiting pending callbacks on " + fileName, e);
+         throw e;
+      } finally {
+
+         opened = false;
+
+         timedBuffer = null;
+
+         aioFile.close();
+
+         aioFile = null;
 
-      aioFile.close();
-      aioFile = null;
+      }
    }
 
    @Override