[
https://issues.apache.org/jira/browse/ARTEMIS-2206?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16738704#comment-16738704
]
ASF GitHub Bot commented on ARTEMIS-2206:
-----------------------------------------
Github user jbertram commented on a diff in the pull request:
https://github.com/apache/activemq-artemis/pull/2466#discussion_r246563323
--- Diff:
tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/mqtt/imported/MQTTQueueCleanTest.java
---
@@ -0,0 +1,109 @@
+/**
+ * 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
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * 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.mqtt.imported;
+
+import org.apache.activemq.artemis.api.core.SimpleString;
+import org.apache.activemq.artemis.core.postoffice.Binding;
+import org.apache.activemq.artemis.core.postoffice.PostOffice;
+import org.apache.activemq.artemis.core.server.ActiveMQServer;
+import org.apache.activemq.artemis.core.server.ActiveMQServerLogger;
+import org.apache.activemq.artemis.core.server.Queue;
+import org.junit.Test;
+
+import java.util.HashSet;
+import java.util.Random;
+import java.util.Set;
+
+public class MQTTQueueCleanTest extends MQTTTestSupport {
+
+ private static final ActiveMQServerLogger log =
ActiveMQServerLogger.LOGGER;
+
+ @Test
+ public void testQueueCleanWhenConnectionSynExeConnectAndDisconnect()
throws Exception {
+ Random random = new Random();
+ Set<MQTTClientProvider> clientProviders = new HashSet<>(11);
+ int repeatCount = 0;
+ String address = "clean/test";
+ String clientId = "sameClientId";
+ String queueName = "::sameClientId.clean.test";
+ //The abnormal scene does not necessarily occur, repeating 100 times
to ensure the recurrence of the abnormality
+ while (repeatCount < 100) {
+ repeatCount++;
+ int subConnectionCount = random.nextInt(50) + 1;
+ int sC = 0;
+ try {
+ //Reconnect at least twice to reproduce the problem
+ while (sC < subConnectionCount) {
+ sC++;
+ MQTTClientProvider clientProvider = getMQTTClientProvider();
+ clientProvider.setClientId(clientId);
+ initializeConnection(clientProvider);
+ clientProviders.add(clientProvider);
+ clientProvider.subscribe(address, AT_LEAST_ONCE);
+ }
+ } finally {
+ for (MQTTClientProvider clientProvider : clientProviders) {
+ clientProvider.disconnect();
+ }
+ clientProviders.clear();
+ assertTrue(waitForBindings(server, queueName, false, 0, 0,
10000));
--- End diff --
From what I can tell the overridden version of `waitForBindings` isn't
necessary. You could just use something like:
`assertTrue(Wait.waitFor(() ->
server.locateQueue(SimpleString.toSimpleString(queueName)) == null));`
> The MQTT consumer reconnection caused the queue to not be cleared and throw a
> NullPointerException exception
> ------------------------------------------------------------------------------------------------------------
>
> Key: ARTEMIS-2206
> URL: https://issues.apache.org/jira/browse/ARTEMIS-2206
> Project: ActiveMQ Artemis
> Issue Type: Bug
> Components: MQTT
> Affects Versions: 2.6.3
> Environment: # Use 10,000 (9 thousand senders, 1 thousand consumers)
> MQTT connection on one server to test Artemis, set the 'cleanSession'
> property to true;
> # MQTT client: paho 1.2.0;
> # Server: CPU Cores:32, Mem:64G, SSD:250G, HDD:1T
> Reporter: Shiping Liang
> Priority: Major
> Attachments: image-2018-12-18-18-28-59-540.png
>
>
> *Issue 1*
> Artemis broker has the following exception log:
> {{[Thread-0
> (ActiveMQ-remoting-threads-ActiveMQServerImpl::serverUUID=fb358579-feb3-11e8-bc7c-141877a7fd13-1409545055)]
> 17:27:59,035 WARN [org.apache.activemq.artemis.utils.actors.OrderedExecutor]
> null: java.lang.NullPointerException at
> org.apache.activemq.artemis.core.protocol.mqtt.MQTTProtocolManager.isClientConnected(MQTTProtocolManager.java:182)
> [:] at
> org.apache.activemq.artemis.core.protocol.mqtt.MQTTConnectionManager.disconnect(MQTTConnectionManager.java:150)
> [:] at
> org.apache.activemq.artemis.core.protocol.mqtt.MQTTFailureListener.connectionFailed(MQTTFailureListener.java:37)
> [:] at
> org.apache.activemq.artemis.core.protocol.mqtt.MQTTConnection.fail(MQTTConnection.java:147)
> [:] at
> org.apache.activemq.artemis.core.remoting.server.impl.RemotingServiceImpl.issueFailure(RemotingServiceImpl.java:561)
> [:] at
> org.apache.activemq.artemis.core.remoting.server.impl.RemotingServiceImpl.connectionDestroyed(RemotingServiceImpl.java:542)
> [:] at
> org.apache.activemq.artemis.core.remoting.impl.netty.NettyAcceptor$Listener.connectionDestroyed(NettyAcceptor.java:858)
> [:] at
> org.apache.activemq.artemis.core.remoting.impl.netty.ActiveMQChannelHandler.lambda$channelInactive$0(ActiveMQChannelHandler.java:83)
> [:] at
> org.apache.activemq.artemis.utils.actors.OrderedExecutor.doTask(OrderedExecutor.java:42)
> [:] at
> org.apache.activemq.artemis.utils.actors.OrderedExecutor.doTask(OrderedExecutor.java:31)
> [:] at
> org.apache.activemq.artemis.utils.actors.ProcessorBase.executePendingTasks(ProcessorBase.java:66)
> [:] at
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
> [rt.jar:1.8.0_101] at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
> [rt.jar:1.8.0_101] at
> org.apache.activemq.artemis.utils.ActiveMQThreadFactory$1.run(ActiveMQThreadFactory.java:118)
> [:]}}
> *Issue 2*
> After closing all client connections, 64 queues were not cleaned up。
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)