You are viewing a plain text version of this content. The canonical link for it is here.
Posted to gitbox@activemq.apache.org by GitBox <gi...@apache.org> on 2020/03/10 23:35:57 UTC

[GitHub] [activemq-artemis] clebertsuconic opened a new pull request #3012: ARTEMIS-2642 Fixing Drain Timeout Issue on AMQP

clebertsuconic opened a new pull request #3012: ARTEMIS-2642 Fixing Drain Timeout Issue on AMQP
URL: https://github.com/apache/activemq-artemis/pull/3012
 
 
   The drain control has to immediately flush
   otherwise a next flow control event may remove the previous status from Proton.
   So, this really cannot wait the next executor, and it has to be done immediately.

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [activemq-artemis] clebertsuconic commented on a change in pull request #3012: ARTEMIS-2642 Fixing Drain Timeout Issue on AMQP

Posted by GitBox <gi...@apache.org>.
clebertsuconic commented on a change in pull request #3012: ARTEMIS-2642 Fixing Drain Timeout Issue on AMQP
URL: https://github.com/apache/activemq-artemis/pull/3012#discussion_r391043572
 
 

 ##########
 File path: tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/DrainTimeoutTest.java
 ##########
 @@ -0,0 +1,93 @@
+/*
+ * 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 javax.jms.JMSConsumer;
+import javax.jms.JMSContext;
+import javax.jms.JMSProducer;
+import javax.jms.Message;
+import javax.jms.Queue;
+import javax.jms.Session;
+import java.util.concurrent.atomic.AtomicInteger;
+import java.util.concurrent.atomic.LongAdder;
+
+import org.apache.qpid.jms.JmsConnectionFactory;
+import org.junit.Assert;
+import org.junit.Test;
+
+public class DrainTimeoutTest extends AmqpClientTestSupport {
+
+   final int NUMBER_OF_MESSAGES = 1000;
+
+   @Test(timeout = 300_000)
+   public void testFlowControl() throws Exception {
+      final AtomicInteger errors = new AtomicInteger(0);
+      final String queueName = getQueueName();
+      JmsConnectionFactory connectionFactory =
+         new JmsConnectionFactory(
+            "tqadmin",
+            "admin",
+            "amqp://localhost:5672?jms.prefetchPolicy.all=1&jms.connectTimeout=60000&amqp.drainTimeout=1000");
+      LongAdder sendCount = new LongAdder();
+      LongAdder consumeCount = new LongAdder();
+      Thread consumerThread =
+         new Thread(
+            () -> {
+               try (JMSContext listenerContext =
+                       connectionFactory.createContext(Session.AUTO_ACKNOWLEDGE)) {
+                  try (JMSConsumer consumer =
+                          listenerContext.createConsumer(
+                             listenerContext.createQueue(queueName))) {
+                     while (!Thread.interrupted()) {
+                        while (true) {
+                           if (consumer.receiveNoWait() == null) {
+                              break;
+                           }
+                           consumeCount.increment();
+                           long consumed = consumeCount.sum();
+                        }
+                        if (consumeCount.sum() == NUMBER_OF_MESSAGES) {
+                           return;
+                        }
+                     }
+                  }
+               } catch (Exception e) {
+                  e.printStackTrace(System.out);
+                  errors.incrementAndGet();
+               }
+            });
+      consumerThread.start();
+      try (JMSContext context = connectionFactory.createContext(Session.AUTO_ACKNOWLEDGE)) {
+         final Message message = context.createMessage();
+         message.setStringProperty("selector", "dude");
+         JMSProducer producer = context.createProducer();
+         Queue queue = context.createQueue(queueName);
+         while (sendCount.sum() < NUMBER_OF_MESSAGES && !Thread.interrupted()) {
+            producer.send(queue, message);
+            sendCount.increment();
+            long sent = sendCount.sum();
+            if (sent % 100 == 0) {
 
 Review comment:
   hmmm... removing this
   I used to have a System.out here

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [activemq-artemis] michaelpearce-gain commented on issue #3012: ARTEMIS-2642 Fixing Drain Timeout Issue on AMQP

Posted by GitBox <gi...@apache.org>.
michaelpearce-gain commented on issue #3012: ARTEMIS-2642 Fixing Drain Timeout Issue on AMQP
URL: https://github.com/apache/activemq-artemis/pull/3012#issuecomment-597710215
 
 
   Have taken this, built and deployed, and we have hit same issue with the flow ceasing, i dont think this has fixed the underlying issue we have.

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [activemq-artemis] clebertsuconic commented on a change in pull request #3012: ARTEMIS-2642 Fixing Drain Timeout Issue on AMQP

Posted by GitBox <gi...@apache.org>.
clebertsuconic commented on a change in pull request #3012: ARTEMIS-2642 Fixing Drain Timeout Issue on AMQP
URL: https://github.com/apache/activemq-artemis/pull/3012#discussion_r390709382
 
 

 ##########
 File path: tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/DrainTimeoutTest.java
 ##########
 @@ -0,0 +1,112 @@
+/*
+ * 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 javax.jms.JMSConsumer;
+import javax.jms.JMSContext;
+import javax.jms.JMSProducer;
+import javax.jms.Message;
+import javax.jms.Queue;
+import javax.jms.Session;
+import java.util.concurrent.atomic.AtomicInteger;
+import java.util.concurrent.atomic.LongAdder;
+
+import org.apache.qpid.jms.JmsConnectionFactory;
+import org.junit.Assert;
+import org.junit.Test;
+
+public class DrainTimeoutTest extends AmqpClientTestSupport {
+
+   final int NUMBER_OF_MESSAGES = 1000;
+
+   @Test(timeout = 300_000)
+   public void testFlowControl() throws Exception {
+      final AtomicInteger errors = new AtomicInteger(0);
+      final String queueName = getQueueName();
+      JmsConnectionFactory connectionFactory =
+         new JmsConnectionFactory(
+            "tqadmin",
+            "admin",
+            "amqp://localhost:5672?jms.prefetchPolicy.all=1&jms.connectTimeout=60000&amqp.drainTimeout=1000");
+      connectionFactory.setExceptionListener(
+         e -> {
+            System.out.println("Got a JMSException.  Terminating the VM.");
 
 Review comment:
   removing this line.. part of my own review.

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [activemq-artemis] clebertsuconic commented on issue #3012: ARTEMIS-2642 Fixing Drain Timeout Issue on AMQP

Posted by GitBox <gi...@apache.org>.
clebertsuconic commented on issue #3012: ARTEMIS-2642 Fixing Drain Timeout Issue on AMQP
URL: https://github.com/apache/activemq-artemis/pull/3012#issuecomment-597371666
 
 
   @michaelandrepearce can you review this one please?

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [activemq-artemis] michaelpearce-gain commented on issue #3012: ARTEMIS-2642 Fixing Drain Timeout Issue on AMQP

Posted by GitBox <gi...@apache.org>.
michaelpearce-gain commented on issue #3012: ARTEMIS-2642 Fixing Drain Timeout Issue on AMQP
URL: https://github.com/apache/activemq-artemis/pull/3012#issuecomment-597519907
 
 
   @clebertsuconic looks promising to fix one of the issues we saw under high load, not sure it 100% explains flow stopping and producer not getting its acks. Will need to patch our existing version and test in a server environment, not sure you're aware we are unable to reproduce the load and the issue locally

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [activemq-artemis] asfgit closed pull request #3012: ARTEMIS-2642 Fixing Drain Timeout Issue on AMQP

Posted by GitBox <gi...@apache.org>.
asfgit closed pull request #3012: ARTEMIS-2642 Fixing Drain Timeout Issue on AMQP
URL: https://github.com/apache/activemq-artemis/pull/3012
 
 
   

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services