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 2018/10/25 15:45:42 UTC

[1/2] activemq-artemis git commit: NO-JIRA Adding log.warn statements in case properties decode fails

Repository: activemq-artemis
Updated Branches:
  refs/heads/master 8099ded5d -> 76342e8e6


NO-JIRA Adding log.warn statements in case properties decode fails


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

Branch: refs/heads/master
Commit: 06c37422fb79e8ed74531bfebd141621f75d7864
Parents: 8099ded
Author: Clebert Suconic <cl...@apache.org>
Authored: Thu Oct 25 11:23:40 2018 -0400
Committer: Clebert Suconic <cl...@apache.org>
Committed: Thu Oct 25 11:28:19 2018 -0400

----------------------------------------------------------------------
 .../artemis/core/message/impl/CoreMessage.java  | 34 ++++++++++++++------
 1 file changed, 24 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/06c37422/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/message/impl/CoreMessage.java
----------------------------------------------------------------------
diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/message/impl/CoreMessage.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/message/impl/CoreMessage.java
index 134ee5e..fa825e8 100644
--- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/message/impl/CoreMessage.java
+++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/message/impl/CoreMessage.java
@@ -25,6 +25,7 @@ import java.util.zip.DataFormatException;
 import java.util.zip.Inflater;
 
 import io.netty.buffer.ByteBuf;
+import io.netty.buffer.ByteBufUtil;
 import io.netty.buffer.UnpooledByteBufAllocator;
 import org.apache.activemq.artemis.api.core.ActiveMQBuffer;
 import org.apache.activemq.artemis.api.core.ActiveMQBuffers;
@@ -558,20 +559,33 @@ public class CoreMessage extends RefCountMessage implements ICoreMessage {
     * I am keeping this synchronized as the decode of the Properties is lazy
     */
    protected TypedProperties checkProperties() {
-      if (properties == null) {
-         synchronized (this) {
-            if (properties == null) {
-               TypedProperties properties = new TypedProperties();
-               if (buffer != null && propertiesLocation >= 0) {
-                  final ByteBuf byteBuf = buffer.duplicate().readerIndex(propertiesLocation);
-                  properties.decode(byteBuf, coreMessageObjectPools == null ? null : coreMessageObjectPools.getPropertiesDecoderPools());
+      try {
+         if (properties == null) {
+            synchronized (this) {
+               if (properties == null) {
+                  TypedProperties properties = new TypedProperties();
+                  if (buffer != null && propertiesLocation >= 0) {
+                     final ByteBuf byteBuf = buffer.duplicate().readerIndex(propertiesLocation);
+                     properties.decode(byteBuf, coreMessageObjectPools == null ? null : coreMessageObjectPools.getPropertiesDecoderPools());
+                  }
+                  this.properties = properties;
                }
-               this.properties = properties;
             }
          }
-      }
 
-      return this.properties;
+         return this.properties;
+      } catch (Throwable e) {
+         ByteBuf duplicatebuffer = buffer.duplicate();
+         duplicatebuffer.readerIndex(0);
+
+         // This is not an expected error, hence no specific logger created
+         logger.warn("Could not decode properties for CoreMessage[messageID=" + messageID + ",durable=" + durable + ",userID=" + userID + ",priority=" + priority +
+            ", timestamp=" + timestamp + ",expiration=" + expiration + ",address=" + address + ", propertiesLocation=" + propertiesLocation, e);
+         logger.warn("Failed message has messageID=" + messageID + " and the following buffer:\n" + ByteBufUtil.prettyHexDump(duplicatebuffer));
+
+         throw new RuntimeException(e.getMessage(), e);
+
+      }
    }
 
    @Override


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

Posted by jb...@apache.org.
This closes #2395


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

Branch: refs/heads/master
Commit: 76342e8e6f0afa7abf14eae61f08675d3a880df7
Parents: 8099ded 06c3742
Author: Justin Bertram <jb...@apache.org>
Authored: Thu Oct 25 10:44:34 2018 -0500
Committer: Justin Bertram <jb...@apache.org>
Committed: Thu Oct 25 10:44:34 2018 -0500

----------------------------------------------------------------------
 .../artemis/core/message/impl/CoreMessage.java  | 34 ++++++++++++++------
 1 file changed, 24 insertions(+), 10 deletions(-)
----------------------------------------------------------------------