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/03/07 23:45:19 UTC

[1/3] activemq-artemis git commit: ARTEMIS-1345 ConcurrentModificationException after copy

Repository: activemq-artemis
Updated Branches:
  refs/heads/master 682216a3e -> c85f0f383


ARTEMIS-1345 ConcurrentModificationException after copy


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

Branch: refs/heads/master
Commit: 8831a570de575f19cbb238e8e1956119061057f2
Parents: 682216a
Author: Clebert Suconic <cl...@apache.org>
Authored: Wed Mar 7 15:04:39 2018 -0500
Committer: Clebert Suconic <cl...@apache.org>
Committed: Wed Mar 7 18:05:35 2018 -0500

----------------------------------------------------------------------
 .../utils/collections/TypedProperties.java      |  6 ++--
 .../artemis/utils/TypedPropertiesTest.java      | 34 ++++++++++++++++++++
 .../artemis/core/server/impl/QueueImpl.java     | 10 +++++-
 3 files changed, 47 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/8831a570/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/collections/TypedProperties.java
----------------------------------------------------------------------
diff --git a/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/collections/TypedProperties.java b/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/collections/TypedProperties.java
index 25c3638..aa2d551 100644
--- a/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/collections/TypedProperties.java
+++ b/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/collections/TypedProperties.java
@@ -80,8 +80,10 @@ public class TypedProperties {
    }
 
    public TypedProperties(final TypedProperties other) {
-      properties = other.properties == null ? null : new HashMap<>(other.properties);
-      size = other.size;
+      synchronized (other) {
+         properties = other.properties == null ? null : new HashMap<>(other.properties);
+         size = other.size;
+      }
    }
 
    public boolean hasInternalProperties() {

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/8831a570/artemis-commons/src/test/java/org/apache/activemq/artemis/utils/TypedPropertiesTest.java
----------------------------------------------------------------------
diff --git a/artemis-commons/src/test/java/org/apache/activemq/artemis/utils/TypedPropertiesTest.java b/artemis-commons/src/test/java/org/apache/activemq/artemis/utils/TypedPropertiesTest.java
index ea044ac..1e0d566 100644
--- a/artemis-commons/src/test/java/org/apache/activemq/artemis/utils/TypedPropertiesTest.java
+++ b/artemis-commons/src/test/java/org/apache/activemq/artemis/utils/TypedPropertiesTest.java
@@ -17,6 +17,8 @@
 package org.apache.activemq.artemis.utils;
 
 import java.util.Iterator;
+import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.concurrent.atomic.AtomicLong;
 
 import io.netty.buffer.ByteBuf;
 import io.netty.buffer.Unpooled;
@@ -255,4 +257,36 @@ public class TypedPropertiesTest {
       final TypedProperties.StringValue.ByteBufStringValuePool pool = new TypedProperties.StringValue.ByteBufStringValuePool(1, tooLong.length() - 1);
       Assert.assertNotSame(pool.getOrCreate(bb), pool.getOrCreate(bb.resetReaderIndex()));
    }
+
+   @Test
+   public void testCopyingWhileMessingUp() throws Exception {
+      TypedProperties properties = new TypedProperties();
+      AtomicBoolean running = new AtomicBoolean(true);
+      AtomicLong copies = new AtomicLong(0);
+      AtomicBoolean error = new AtomicBoolean(false);
+      Thread t = new Thread() {
+         @Override
+         public void run() {
+            while (running.get() && !error.get()) {
+               try {
+                  copies.incrementAndGet();
+                  TypedProperties copiedProperties = new TypedProperties(properties);
+               } catch (Throwable e) {
+                  e.printStackTrace();
+                  error.set(true);
+               }
+            }
+         }
+      };
+      t.start();
+      for (int i = 0; !error.get() && (i < 100 || copies.get() < 5000); i++) {
+         properties.putIntProperty(SimpleString.toSimpleString("key" + i), i);
+      }
+
+      running.set(false);
+
+      t.join();
+
+      Assert.assertFalse(error.get());
+   }
 }

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/8831a570/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/QueueImpl.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/QueueImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/QueueImpl.java
index b9adf33..0d018dc 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/QueueImpl.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/QueueImpl.java
@@ -2324,7 +2324,15 @@ public class QueueImpl extends CriticalComponentImpl implements Queue {
 
                   handled++;
                } else if (status == HandleStatus.BUSY) {
-                  holder.iter.repeat();
+                  try {
+                     holder.iter.repeat();
+                  } catch (NoSuchElementException e) {
+                     // this could happen if there was an exception on the queue handling
+                     // and it returned BUSY because of that exception
+                     //
+                     // We will just log it as there's nothing else we can do now.
+                     logger.warn(e.getMessage(), e);
+                  }
 
                   noDelivery++;
                } else if (status == HandleStatus.NO_MATCH) {


[3/3] activemq-artemis git commit: This closes #1937

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


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

Branch: refs/heads/master
Commit: c85f0f3831ede5fc8482655366ebb754c7e68b2a
Parents: 682216a 2a9381c
Author: Clebert Suconic <cl...@apache.org>
Authored: Wed Mar 7 18:45:09 2018 -0500
Committer: Clebert Suconic <cl...@apache.org>
Committed: Wed Mar 7 18:45:09 2018 -0500

----------------------------------------------------------------------
 .../utils/collections/TypedProperties.java      |  6 ++--
 .../artemis/utils/TypedPropertiesTest.java      | 34 ++++++++++++++++++++
 .../artemis/core/server/impl/QueueImpl.java     | 10 +++++-
 .../ra/ActiveMQResourceAdapterConfigTest.java   |  6 ++++
 4 files changed, 53 insertions(+), 3 deletions(-)
----------------------------------------------------------------------



[2/3] activemq-artemis git commit: ARTEMIS-1669 Fixing test

Posted by cl...@apache.org.
ARTEMIS-1669 Fixing test


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

Branch: refs/heads/master
Commit: 2a9381cd26f5c95e403d1d8ae507f7507d7fd616
Parents: 8831a57
Author: Clebert Suconic <cl...@apache.org>
Authored: Wed Mar 7 18:14:51 2018 -0500
Committer: Clebert Suconic <cl...@apache.org>
Committed: Wed Mar 7 18:14:51 2018 -0500

----------------------------------------------------------------------
 .../tests/unit/ra/ActiveMQResourceAdapterConfigTest.java       | 6 ++++++
 1 file changed, 6 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/2a9381cd/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/ra/ActiveMQResourceAdapterConfigTest.java
----------------------------------------------------------------------
diff --git a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/ra/ActiveMQResourceAdapterConfigTest.java b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/ra/ActiveMQResourceAdapterConfigTest.java
index 9afefd9..96992aa 100644
--- a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/ra/ActiveMQResourceAdapterConfigTest.java
+++ b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/ra/ActiveMQResourceAdapterConfigTest.java
@@ -408,6 +408,12 @@ public class ActiveMQResourceAdapterConfigTest extends ActiveMQTestBase {
       "         <config-property-name>DeserializationBlackList</config-property-name>" +
       "         <config-property-type>java.lang.String</config-property-type>" +
       "         <config-property-value></config-property-value>" +
+      "      </config-property>" +
+      "      <config-property>" +
+      "         <description>***add***</description>" +
+      "         <config-property-name>IgnoreJTA</config-property-name>" +
+      "         <config-property-type>boolean</config-property-type>" +
+      "         <config-property-value></config-property-value>" +
       "      </config-property>";
 
    private static String rootConfig = "<root>" + config + commentedOutConfigs + "</root>";