[ 
https://issues.apache.org/jira/browse/ARTEMIS-3310?focusedWorklogId=599965&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-599965
 ]

ASF GitHub Bot logged work on ARTEMIS-3310:
-------------------------------------------

                Author: ASF GitHub Bot
            Created on: 20/May/21 18:51
            Start Date: 20/May/21 18:51
    Worklog Time Spent: 10m 
      Work Description: franz1981 commented on a change in pull request #3591:
URL: https://github.com/apache/activemq-artemis/pull/3591#discussion_r636383902



##########
File path: 
tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/ParseAppMultiThread.java
##########
@@ -0,0 +1,99 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.artemis.tests.integration.amqp;
+
+import java.lang.reflect.Field;
+import java.util.HashMap;
+import java.util.concurrent.CyclicBarrier;
+import java.util.concurrent.atomic.AtomicInteger;
+
+import org.apache.activemq.artemis.api.core.ActiveMQBuffer;
+import org.apache.activemq.artemis.api.core.ActiveMQBuffers;
+import org.apache.activemq.artemis.api.core.SimpleString;
+import org.apache.activemq.artemis.protocol.amqp.broker.AMQPMessage;
+import org.apache.activemq.artemis.protocol.amqp.broker.AMQPMessagePersisterV2;
+import org.apache.activemq.artemis.protocol.amqp.broker.AMQPStandardMessage;
+import org.apache.activemq.artemis.utils.RandomUtil;
+import org.junit.Assert;
+import org.junit.Test;
+
+public class ParseAppMultiThread {
+
+
+   @Test
+   public void testMultiThreadParsing() throws Exception {
+
+      for (int rep = 0; rep < 500; rep++) {
+         String randomStr = RandomUtil.randomString();
+         HashMap map = new HashMap();
+         map.put("color", randomStr);
+         for (int i = 0; i < 10; i++) {
+            map.put("stuff" + i, "value" + i); // just filling stuff
+         }
+         AMQPStandardMessage originalMessage = 
AMQPStandardMessage.createMessage(1, 0, SimpleString.toSimpleString("duh"), 
null, null, null, null, map, null, null);
+
+
+         // doing a round trip that would be made through persistence
+         AMQPMessagePersisterV2 persister = 
AMQPMessagePersisterV2.getInstance();
+
+         ActiveMQBuffer buffer = ActiveMQBuffers.dynamicBuffer(1024);
+         persister.encode(buffer, originalMessage);
+         buffer.readerIndex(1);
+
+         AMQPStandardMessage amqpStandardMessage = (AMQPStandardMessage) 
persister.decode(buffer, null, null);
+
+
+         if (rep == 0) {
+            // it is enough to check the first time only
+            // this is to make sure the message does not have application 
properties parsed
+            Field field = 
AMQPMessage.class.getDeclaredField("applicationProperties");

Review comment:
       @clebertsuconic there is the state of parsing as an enum exposed for 
testing purposes




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Issue Time Tracking
-------------------

    Worklog Id:     (was: 599965)
    Time Spent: 0.5h  (was: 20m)

> Paging could lose AMQPmessage if match didn't work for any reason
> -----------------------------------------------------------------
>
>                 Key: ARTEMIS-3310
>                 URL: https://issues.apache.org/jira/browse/ARTEMIS-3310
>             Project: ActiveMQ Artemis
>          Issue Type: Bug
>            Reporter: Clebert Suconic
>            Assignee: Clebert Suconic
>            Priority: Major
>          Time Spent: 0.5h
>  Remaining Estimate: 0h
>
> AMQP will parse properties on demand.
> However if something happened, paging.next() would re-validate the routing 
> from the queue, and if the routing did not work, it would then remove the 
> message from the paging store without even informing the Queue about this.
>  
> This was because message.match() was meant for browsing only, and when the 
> module was originally contemplated it was though the filter on the queue 
> could be changed, resulting in just removing old messages from the queue. 
> That is not true as a filter change should result in removing and recreating 
> the message.
>  
> this should be fixed in two parts:
>  
> I - add a test to make sure parsing works
>  
> II - Make cursor.moveNext() more resilient to a failure here and just trust 
> the original routing without having to retake the matching.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to