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 2016/01/20 23:51:09 UTC

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

Repository: activemq-artemis
Updated Branches:
  refs/heads/master 64b38838f -> b9a9ca628


This closes #333


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

Branch: refs/heads/master
Commit: b9a9ca628b19d76bd866cb5ac73c08e541b1f433
Parents: 64b3883 85a2c19
Author: Clebert Suconic <cl...@apache.org>
Authored: Wed Jan 20 17:50:56 2016 -0500
Committer: Clebert Suconic <cl...@apache.org>
Committed: Wed Jan 20 17:50:56 2016 -0500

----------------------------------------------------------------------
 .../core/io/aio/AIOSequentialFileFactory.java   |  46 ++++++++-----------
 artemis-native/bin/libartemis-native-32.so      | Bin 26789 -> 26789 bytes
 artemis-native/bin/libartemis-native-64.so      | Bin 25003 -> 25003 bytes
 ...che_activemq_artemis_jlibaio_LibaioContext.c |   9 +++-
 .../activemq/artemis/jlibaio/LibaioContext.java |   2 +-
 5 files changed, 29 insertions(+), 28 deletions(-)
----------------------------------------------------------------------



[2/2] activemq-artemis git commit: ARTEMIS-353 retrying after interrupts on the native layer because of jmap issuing weird interrupts

Posted by cl...@apache.org.
ARTEMIS-353 retrying after interrupts on the native layer because of jmap issuing weird interrupts

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


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

Branch: refs/heads/master
Commit: 85a2c191cf0b3c0bbadcb318eb165213856f8d38
Parents: 64b3883
Author: Clebert Suconic <cl...@apache.org>
Authored: Wed Jan 20 14:07:47 2016 -0500
Committer: Clebert Suconic <cl...@apache.org>
Committed: Wed Jan 20 17:50:56 2016 -0500

----------------------------------------------------------------------
 .../core/io/aio/AIOSequentialFileFactory.java   |  46 ++++++++-----------
 artemis-native/bin/libartemis-native-32.so      | Bin 26789 -> 26789 bytes
 artemis-native/bin/libartemis-native-64.so      | Bin 25003 -> 25003 bytes
 ...che_activemq_artemis_jlibaio_LibaioContext.c |   9 +++-
 .../activemq/artemis/jlibaio/LibaioContext.java |   2 +-
 5 files changed, 29 insertions(+), 28 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/85a2c191/artemis-journal/src/main/java/org/apache/activemq/artemis/core/io/aio/AIOSequentialFileFactory.java
----------------------------------------------------------------------
diff --git a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/io/aio/AIOSequentialFileFactory.java b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/io/aio/AIOSequentialFileFactory.java
index 58f7248..b7bb47e 100644
--- a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/io/aio/AIOSequentialFileFactory.java
+++ b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/io/aio/AIOSequentialFileFactory.java
@@ -19,12 +19,7 @@ package org.apache.activemq.artemis.core.io.aio;
 import java.io.File;
 import java.io.IOException;
 import java.nio.ByteBuffer;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
 import java.util.concurrent.ConcurrentLinkedQueue;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicBoolean;
 
 import org.apache.activemq.artemis.ArtemisConstants;
@@ -38,7 +33,6 @@ import org.apache.activemq.artemis.jlibaio.LibaioFile;
 import org.apache.activemq.artemis.jlibaio.SubmitInfo;
 import org.apache.activemq.artemis.jlibaio.util.CallbackCache;
 import org.apache.activemq.artemis.journal.ActiveMQJournalLogger;
-import org.apache.activemq.artemis.utils.ActiveMQThreadFactory;
 
 public final class AIOSequentialFileFactory extends AbstractSequentialFileFactory {
 
@@ -48,7 +42,7 @@ public final class AIOSequentialFileFactory extends AbstractSequentialFileFactor
 
    private volatile boolean reuseBuffers = true;
 
-   private ExecutorService pollerExecutor;
+   private Thread pollerThread;
 
    volatile LibaioContext<AIOSequentialCallback> libaioContext;
 
@@ -195,14 +189,8 @@ public final class AIOSequentialFileFactory extends AbstractSequentialFileFactor
 
          this.running.set(true);
 
-         pollerExecutor = Executors.newCachedThreadPool(AccessController.doPrivileged(new PrivilegedAction<ActiveMQThreadFactory>() {
-            @Override
-            public ActiveMQThreadFactory run() {
-               return new ActiveMQThreadFactory("ActiveMQ-AIO-poller-pool" + System.identityHashCode(this), true, AIOSequentialFileFactory.class.getClassLoader());
-            }
-         }));
-
-         pollerExecutor.execute(new PollerRunnable());
+         pollerThread = new PollerThread();
+         pollerThread.start();
       }
 
    }
@@ -215,11 +203,11 @@ public final class AIOSequentialFileFactory extends AbstractSequentialFileFactor
          libaioContext.close();
          libaioContext = null;
 
-         if (pollerExecutor != null) {
-            pollerExecutor.shutdown();
-
+         if (pollerThread != null) {
             try {
-               if (!pollerExecutor.awaitTermination(AbstractSequentialFileFactory.EXECUTOR_TIMEOUT, TimeUnit.SECONDS)) {
+               pollerThread.join(AbstractSequentialFileFactory.EXECUTOR_TIMEOUT * 1000);
+
+               if (pollerThread.isAlive()) {
                   ActiveMQJournalLogger.LOGGER.timeoutOnPollerShutdown(new Exception("trace"));
                }
             }
@@ -232,11 +220,6 @@ public final class AIOSequentialFileFactory extends AbstractSequentialFileFactor
       }
    }
 
-   @Override
-   protected void finalize() {
-      stop();
-   }
-
    /**
     * The same callback is used for Runnable executor.
     * This way we can save some memory over the pool.
@@ -348,11 +331,22 @@ public final class AIOSequentialFileFactory extends AbstractSequentialFileFactor
       }
    }
 
-   private class PollerRunnable implements Runnable {
+   private class PollerThread extends Thread {
+
+      public PollerThread() {
+         super("Apache ActiveMQ Artemis libaio poller");
+      }
 
       @Override
       public void run() {
-         libaioContext.poll();
+         while (running.get()) {
+            try {
+               libaioContext.poll();
+            }
+            catch (Throwable e) {
+               ActiveMQJournalLogger.LOGGER.warn(e.getMessage(), e);
+            }
+         }
       }
    }
 

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/85a2c191/artemis-native/bin/libartemis-native-32.so
----------------------------------------------------------------------
diff --git a/artemis-native/bin/libartemis-native-32.so b/artemis-native/bin/libartemis-native-32.so
index 7a7f451..fb4773b 100755
Binary files a/artemis-native/bin/libartemis-native-32.so and b/artemis-native/bin/libartemis-native-32.so differ

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/85a2c191/artemis-native/bin/libartemis-native-64.so
----------------------------------------------------------------------
diff --git a/artemis-native/bin/libartemis-native-64.so b/artemis-native/bin/libartemis-native-64.so
index a938c70..95a5451 100644
Binary files a/artemis-native/bin/libartemis-native-64.so and b/artemis-native/bin/libartemis-native-64.so differ

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/85a2c191/artemis-native/src/main/c/org_apache_activemq_artemis_jlibaio_LibaioContext.c
----------------------------------------------------------------------
diff --git a/artemis-native/src/main/c/org_apache_activemq_artemis_jlibaio_LibaioContext.c b/artemis-native/src/main/c/org_apache_activemq_artemis_jlibaio_LibaioContext.c
index 0d09ed1..860d192 100644
--- a/artemis-native/src/main/c/org_apache_activemq_artemis_jlibaio_LibaioContext.c
+++ b/artemis-native/src/main/c/org_apache_activemq_artemis_jlibaio_LibaioContext.c
@@ -557,9 +557,16 @@ JNIEXPORT void JNICALL Java_org_apache_activemq_artemis_jlibaio_LibaioContext_bl
 
         int result = io_getevents(theControl->ioContext, 1, max, theControl->events, 0);
 
+        if (result == -EINTR)
+        {
+           // ARTEMIS-353: jmap will issue some weird interrupt signal what would break the execution here
+           // we need to ignore such calls here
+           continue;
+        }
+
         if (result < 0)
         {
-            throwIOExceptionErrorNo(env, "Error while submitting IO: ", -result);
+            throwIOExceptionErrorNo(env, "Error while calling io_getevents IO: ", -result);
             break;
         }
         #ifdef DEBUG

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/85a2c191/artemis-native/src/main/java/org/apache/activemq/artemis/jlibaio/LibaioContext.java
----------------------------------------------------------------------
diff --git a/artemis-native/src/main/java/org/apache/activemq/artemis/jlibaio/LibaioContext.java b/artemis-native/src/main/java/org/apache/activemq/artemis/jlibaio/LibaioContext.java
index f7cc0d3..75db50d 100644
--- a/artemis-native/src/main/java/org/apache/activemq/artemis/jlibaio/LibaioContext.java
+++ b/artemis-native/src/main/java/org/apache/activemq/artemis/jlibaio/LibaioContext.java
@@ -49,7 +49,7 @@ public class LibaioContext<Callback extends SubmitInfo> implements Closeable {
     * <br>
     * Or else the native module won't be loaded because of version mismatches
     */
-   private static final int EXPECTED_NATIVE_VERSION = 5;
+   private static final int EXPECTED_NATIVE_VERSION = 6;
 
    private static boolean loaded = false;