diff --git a/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/collections/RepeatableIterator.java b/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/collections/RepeatableIterator.java index cb41eea7c8..a5748d0952 100644 --- a/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/collections/RepeatableIterator.java +++ b/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/collections/RepeatableIterator.java @@ -24,4 +24,6 @@ public interface RepeatableIterator extends Iterator { * If the current value should repeat. */ void repeat(); + + void removed(E itemRemoved); } diff --git a/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/collections/RepeatableIteratorWrapper.java b/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/collections/RepeatableIteratorWrapper.java index 2c23cba53a..fb1981a8f8 100644 --- a/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/collections/RepeatableIteratorWrapper.java +++ b/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/collections/RepeatableIteratorWrapper.java @@ -35,6 +35,13 @@ public class RepeatableIteratorWrapper implements RepeatableIterator, Rese } } + @Override + public void removed(E removed) { + if (last == removed) { + last = null; + } + } + @Override public boolean hasNext() { return repeat || iterator.hasNext(); diff --git a/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/collections/UpdatableIterator.java b/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/collections/UpdatableIterator.java index 204f672697..d475ddf7e3 100644 --- a/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/collections/UpdatableIterator.java +++ b/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/collections/UpdatableIterator.java @@ -87,4 +87,9 @@ public class UpdatableIterator implements ResettableIterator, RepeatableIt public void repeat() { currentIterator.repeat(); } + + @Override + public void removed(E removed) { + currentIterator.removed(removed); + } } diff --git a/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireConnection.java b/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireConnection.java index 8a710c2aa0..04aa8a02ff 100644 --- a/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireConnection.java +++ b/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireConnection.java @@ -24,6 +24,7 @@ import java.util.Map; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.Executor; +import java.util.concurrent.ScheduledFuture; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicLongFieldUpdater; @@ -154,6 +155,8 @@ public class OpenWireConnection extends AbstractRemotingConnection implements Se private boolean destroyed = false; + private volatile ScheduledFuture ttlCheck; + //separated in/out wireFormats allow deliveries (eg async and consumers) to not slow down bufferReceived private final OpenWireFormat inWireFormat; @@ -686,10 +689,18 @@ public class OpenWireConnection extends AbstractRemotingConnection implements Se private void shutdown(boolean fail) { - if (fail) { - transportConnection.forceClose(); - } else { - transportConnection.close(); + try { + if (fail) { + transportConnection.forceClose(); + } else { + transportConnection.close(); + } + } finally { + ScheduledFuture ttlCheckToCancel = this.ttlCheck; + this.ttlCheck = null; + if (ttlCheckToCancel != null) { + ttlCheckToCancel.cancel(true); + } } } @@ -1012,7 +1023,7 @@ public class OpenWireConnection extends AbstractRemotingConnection implements Se this.maxInactivityDuration = inactivityDuration; if (this.useKeepAlive) { - protocolManager.getScheduledPool().schedule(new Runnable() { + ttlCheck = protocolManager.getScheduledPool().schedule(new Runnable() { @Override public void run() { if (inactivityDuration >= 0) { diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/QueueConsumersImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/QueueConsumersImpl.java index e3964a1d22..e32bbccac6 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/QueueConsumersImpl.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/QueueConsumersImpl.java @@ -86,11 +86,20 @@ public class QueueConsumersImpl implements QueueConsume return result; } + @Override + public void removed(T t) { + iterator.removed(t); + } + @Override public boolean remove(T t) { + iterator.removed(t); boolean result = consumers.remove(t); if (result) { iterator.update(consumers.resettableIterator()); + if (consumers.isEmpty()) { + reset(); + } } return result; } 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 e664cbc998..2aeb364588 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 @@ -1457,7 +1457,7 @@ public class QueueImpl extends CriticalComponentImpl implements Queue { groups.removeAll(); } - ConsumerHolder newConsumerHolder = new ConsumerHolder<>(consumer); + ConsumerHolder newConsumerHolder = new ConsumerHolder<>(consumer, this); if (consumers.add(newConsumerHolder)) { if (delayBeforeDispatch >= 0) { dispatchStartTimeUpdater.compareAndSet(this,-1, delayBeforeDispatch + System.currentTimeMillis()); @@ -1480,6 +1480,7 @@ public class QueueImpl extends CriticalComponentImpl implements Queue { @Override public void removeConsumer(final Consumer consumer) { + logger.debug("Removing consumer {}", consumer); try (ArtemisCloseable metric = measureCritical(CRITICAL_CONSUMER)) { synchronized (this) { @@ -1489,6 +1490,7 @@ public class QueueImpl extends CriticalComponentImpl implements Queue { if (holder.consumer == consumer) { if (holder.iter != null) { holder.iter.close(); + holder.iter = null; } consumers.remove(holder); consumerRemoved = true; @@ -3393,7 +3395,7 @@ public class QueueImpl extends CriticalComponentImpl implements Queue { if (redistributor == null && (consumers.isEmpty() || hasUnMatchedPending)) { logger.trace("QueueImpl::Adding redistributor on queue {}", this); - redistributor = new ConsumerHolder(new Redistributor(this, storageManager, postOffice)); + redistributor = new ConsumerHolder(new Redistributor(this, storageManager, postOffice), this); redistributor.consumer.start(); consumers.add(redistributor); hasUnMatchedPending = false; @@ -4220,11 +4222,13 @@ public class QueueImpl extends CriticalComponentImpl implements Queue { protected static class ConsumerHolder implements PriorityAware { - ConsumerHolder(final T consumer) { + ConsumerHolder(final T consumer, final QueueImpl queue) { this.consumer = consumer; + this.queue = queue; } final T consumer; + final QueueImpl queue; LinkedListIterator iter; @@ -4256,6 +4260,11 @@ public class QueueImpl extends CriticalComponentImpl implements Queue { public int getPriority() { return consumer.getPriority(); } + + @Override + public String toString() { + return "ConsumerHolder::queue=" + queue + ", consumer=" + consumer; + } } private class DelayedAddRedistributor implements Runnable { diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServerConsumerImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServerConsumerImpl.java index d75a939336..a13d362af1 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServerConsumerImpl.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServerConsumerImpl.java @@ -97,7 +97,7 @@ public class ServerConsumerImpl implements ServerConsumer, ReadyListener { private final int minLargeMessageSize; - private final ServerSession session; + private ServerSession session; protected final Object lock = new Object(); @@ -141,7 +141,7 @@ public class ServerConsumerImpl implements ServerConsumer, ReadyListener { private final java.util.Deque deliveringRefs = new ArrayDeque<>(); - private final SessionCallback callback; + private SessionCallback callback; private boolean preAcknowledge; @@ -617,6 +617,12 @@ public class ServerConsumerImpl implements ServerConsumer, ReadyListener { if (server.hasBrokerConsumerPlugins()) { server.callBrokerConsumerPlugins(plugin -> plugin.afterCloseConsumer(this, failed)); } + + protocolContext = null; + + callback = null; + + session = null; } private void addLingerRefs() throws Exception { diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServerStatus.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServerStatus.java index fd2e78f18c..96e8fdc0bd 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServerStatus.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServerStatus.java @@ -33,6 +33,11 @@ public class ServerStatus { private static final ServerStatus instance = new ServerStatus(); + public static void clear() { + instance.server = null; + instance.immutableStateValues.clear(); + } + public static synchronized ServerStatus getInstanceFor(ActiveMQServerImpl activeMQServer) { if (instance.server == null) { instance.server = activeMQServer; diff --git a/artemis-server/src/test/java/org/apache/activemq/artemis/tests/util/ActiveMQTestBase.java b/artemis-server/src/test/java/org/apache/activemq/artemis/tests/util/ActiveMQTestBase.java index 3a19d098dc..95015ba719 100644 --- a/artemis-server/src/test/java/org/apache/activemq/artemis/tests/util/ActiveMQTestBase.java +++ b/artemis-server/src/test/java/org/apache/activemq/artemis/tests/util/ActiveMQTestBase.java @@ -251,6 +251,9 @@ public abstract class ActiveMQTestBase extends Assert { } + protected void clearServers() { + servers.clear(); + } private final Collection servers = new ArrayList<>(); private final Collection locators = new ArrayList<>(); @@ -364,7 +367,7 @@ public abstract class ActiveMQTestBase extends Assert { } stopComponentOutputExceptions(server); } - servers.clear(); + clearServers(); } closeAllOtherComponents(); diff --git a/pom.xml b/pom.xml index a6ae7251de..7c1f674373 100644 --- a/pom.xml +++ b/pom.xml @@ -190,6 +190,7 @@ true true true + true true true true @@ -1277,6 +1278,7 @@ true true false + false @@ -1289,6 +1291,7 @@ false false false + false false + + 4.0.0 + + + org.apache.activemq.tests + artemis-tests-pom + 2.29.0-SNAPSHOT + + + leak-tests + jar + ActiveMQ Artemis Leak Tests + + + ${project.basedir}/../.. + 0.7 + + checkleak.lib + + + + + + org.apache.activemq + artemis-server + ${project.version} + test + test-jar + + + + + org.apache.activemq + artemis-unit-test-support + ${project.version} + test + + + + + org.apache.activemq.tests + artemis-test-support + ${project.version} + + + + + org.apache.activemq + artemis-server + ${project.version} + test + + + org.apache.activemq + artemis-journal + ${project.version} + test + + + org.apache.activemq + artemis-amqp-protocol + ${project.version} + test + + + org.apache.activemq + artemis-stomp-protocol + ${project.version} + test + + + org.apache.activemq + artemis-openwire-protocol + ${project.version} + test + + + org.apache.activemq + activemq-artemis-native + ${activemq-artemis-native-version} + test + + + org.apache.activemq + artemis-mqtt-protocol + ${project.version} + test + + + + + org.apache.activemq + activemq-client + test + + + + org.apache.geronimo.specs + geronimo-jms_1.1_spec + + + + org.apache.geronimo.specs + geronimo-j2ee-management_1.1_spec + + + + + + jakarta.management.j2ee + jakarta.management.j2ee-api + test + + + + + org.apache.activemq + artemis-jms-client + ${project.version} + test + + + + + org.apache.qpid + qpid-jms-client + test + + + + + org.slf4j + slf4j-api + test + + + org.apache.logging.log4j + log4j-slf4j-impl + test + + + + + org.apache.johnzon + johnzon-core + test + + + jakarta.json + jakarta.json-api + test + + + + + io.github.check-leak + core + ${check-leak-version} + test + + + + + junit + junit + test + + + + + + + src/test/resources + true + + + + + + io.github.check-leak + checkleak-maven-plugin + ${check-leak-version} + + + generate-sources + find-native + + install + + + ${project.basedir}/target/lib + + ${check-leak-deploy-name} + + + + + + maven-resources-plugin + + + jks + + + + + copy-security-resources + validate + + copy-resources + + + ${basedir}/target/test-classes + + + ../security-resources + + + + + + + + org.apache.maven.plugins + maven-surefire-plugin + + ${skipLeakTests} + -agentpath:${project.basedir}/target/lib/${check-leak-deploy-name} -Djgroups.bind_addr=::1 ${activemq-surefire-argline} -Dorg.apache.activemq.SERIALIZABLE_PACKAGES="java.lang,javax.security,java.util,org.apache.activemq,org.fusesource.hawtbuf" + + + + + + diff --git a/tests/leak-tests/src/test/java/org/apache/activemq/artemis/tests/leak/ConnectionLeakTest.java b/tests/leak-tests/src/test/java/org/apache/activemq/artemis/tests/leak/ConnectionLeakTest.java new file mode 100644 index 0000000000..6aab2271bf --- /dev/null +++ b/tests/leak-tests/src/test/java/org/apache/activemq/artemis/tests/leak/ConnectionLeakTest.java @@ -0,0 +1,177 @@ +/* + * 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.leak; + +import javax.jms.Connection; +import javax.jms.ConnectionFactory; +import javax.jms.Destination; +import javax.jms.Message; +import javax.jms.MessageConsumer; +import javax.jms.MessageProducer; +import javax.jms.Session; +import javax.jms.TextMessage; + +import java.lang.invoke.MethodHandles; + +import org.apache.activemq.artemis.core.protocol.core.impl.RemotingConnectionImpl; +import org.apache.activemq.artemis.core.server.Queue; +import org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl; +import org.apache.activemq.artemis.core.server.impl.ServerStatus; +import org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory; +import org.apache.activemq.artemis.tests.util.CFUtil; +import org.apache.activemq.artemis.utils.Wait; +import io.github.checkleak.core.CheckLeak; +import org.apache.activemq.artemis.core.server.ActiveMQServer; +import org.apache.activemq.artemis.tests.util.ActiveMQTestBase; +import org.junit.After; +import org.junit.Assert; +import org.junit.Assume; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import static org.apache.activemq.artemis.tests.leak.MemoryAssertions.assertMemory; +import static org.apache.activemq.artemis.tests.leak.MemoryAssertions.basicMemoryAsserts; + +public class ConnectionLeakTest extends ActiveMQTestBase { + + private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); + + ActiveMQServer server; + + @BeforeClass + public static void beforeClass() throws Exception { + Assume.assumeTrue(CheckLeak.isLoaded()); + } + + @After + public void validateServer() throws Exception { + CheckLeak checkLeak = new CheckLeak(); + + // I am doing this check here because the test method might hold a client connection + // so this check has to be done after the test, and before the server is stopped + assertMemory(checkLeak, 0, RemotingConnectionImpl.class.getName()); + + server.stop(); + + server = null; + + clearServers(); + ServerStatus.clear(); + + assertMemory(checkLeak, 0, ActiveMQServerImpl.class.getName()); + } + + @Override + @Before + public void setUp() throws Exception { + server = createServer(true, createDefaultConfig(1, true)); + server.start(); + } + + @Test + public void testAMQP() throws Exception { + doTest("AMQP"); + } + + @Test + public void testCore() throws Exception { + doTest("CORE"); + } + + @Test + public void testOpenWire() throws Exception { + doTest("OPENWIRE"); + } + + private void doTest(String protocol) throws Exception { + int REPEATS = 100; + int MESSAGES = 20; + basicMemoryAsserts(); + + ConnectionFactory cf = CFUtil.createConnectionFactory(protocol, "tcp://localhost:61616"); + + try (Connection producerConnection = cf.createConnection(); Connection consumerConnection = cf.createConnection()) { + + Session producerSession = producerConnection.createSession(true, Session.SESSION_TRANSACTED); + + Session consumerSession = consumerConnection.createSession(true, Session.SESSION_TRANSACTED); + consumerConnection.start(); + + for (int i = 0; i < REPEATS; i++) { + { + Destination source = producerSession.createQueue("source"); + try (MessageProducer sourceProducer = producerSession.createProducer(source)) { + for (int msg = 0; msg < MESSAGES; msg++) { + Message message = producerSession.createTextMessage("hello " + msg); + message.setIntProperty("i", msg); + sourceProducer.send(message); + } + producerSession.commit(); + } + } + { + Destination source = consumerSession.createQueue("source"); + Destination target = consumerSession.createQueue("target"); + // notice I am not closing the consumer directly, just relying on the connection closing + MessageProducer targetProducer = consumerSession.createProducer(target); + // I am receiving messages, and pushing them to a different queue + try (MessageConsumer sourceConsumer = consumerSession.createConsumer(source)) { + for (int msg = 0; msg < MESSAGES; msg++) { + + TextMessage m = (TextMessage) sourceConsumer.receive(5000); + Assert.assertNotNull(m); + Assert.assertEquals("hello " + msg, m.getText()); + Assert.assertEquals(msg, m.getIntProperty("i")); + targetProducer.send(m); + } + Assert.assertNull(sourceConsumer.receiveNoWait()); + } + consumerSession.commit(); + } + } + } + + // this is just to drain the messages + try (Connection targetConnection = cf.createConnection(); Connection consumerConnection = cf.createConnection()) { + Session targetSession = targetConnection.createSession(false, Session.AUTO_ACKNOWLEDGE); + MessageConsumer consumer = targetSession.createConsumer(targetSession.createQueue("target")); + targetConnection.start(); + + for (int msgI = 0; msgI < REPEATS * MESSAGES; msgI++) { + Assert.assertNotNull(consumer.receive(5000)); + } + + Assert.assertNull(consumer.receiveNoWait()); + } + + Queue sourceQueue = server.locateQueue("source"); + Queue targetQueue = server.locateQueue("target"); + + Wait.assertEquals(0, sourceQueue::getMessageCount); + Wait.assertEquals(0, targetQueue::getMessageCount); + + if (cf instanceof ActiveMQConnectionFactory) { + ((ActiveMQConnectionFactory)cf).close(); + } + + basicMemoryAsserts(); + + } +} \ No newline at end of file diff --git a/tests/leak-tests/src/test/java/org/apache/activemq/artemis/tests/leak/MemoryAssertions.java b/tests/leak-tests/src/test/java/org/apache/activemq/artemis/tests/leak/MemoryAssertions.java new file mode 100644 index 0000000000..931488e4b9 --- /dev/null +++ b/tests/leak-tests/src/test/java/org/apache/activemq/artemis/tests/leak/MemoryAssertions.java @@ -0,0 +1,66 @@ +/* + * 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.leak; + +import java.lang.invoke.MethodHandles; + +import io.github.checkleak.core.CheckLeak; +import org.apache.activemq.artemis.core.protocol.openwire.OpenWireConnection; +import org.apache.activemq.artemis.core.server.impl.MessageReferenceImpl; +import org.apache.activemq.artemis.core.server.impl.RoutingContextImpl; +import org.apache.activemq.artemis.core.server.impl.ServerConsumerImpl; +import org.apache.activemq.artemis.protocol.amqp.proton.AMQPSessionContext; +import org.apache.activemq.artemis.protocol.amqp.proton.ProtonServerReceiverContext; +import org.apache.activemq.artemis.protocol.amqp.proton.ProtonServerSenderContext; +import org.apache.activemq.artemis.utils.Wait; +import org.junit.Assert; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class MemoryAssertions { + + private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); + + /** most tests should have these as 0 after execution. */ + public static void basicMemoryAsserts() throws Exception { + CheckLeak checkLeak = new CheckLeak(); + assertMemory(checkLeak, 0, OpenWireConnection.class.getName()); + assertMemory(checkLeak, 0, ProtonServerSenderContext.class.getName()); + assertMemory(checkLeak, 0, ProtonServerReceiverContext.class.getName()); + assertMemory(checkLeak, 0, AMQPSessionContext.class.getName()); + assertMemory(checkLeak, 0, ServerConsumerImpl.class.getName()); + assertMemory(checkLeak, 0, RoutingContextImpl.class.getName()); + assertMemory(checkLeak, 0, MessageReferenceImpl.class.getName()); + } + + public static void assertMemory(CheckLeak checkLeak, int maxExpected, String clazz) throws Exception { + Wait.waitFor(() -> checkLeak.getAllObjects(clazz).length <= maxExpected, 5000, 100); + + Object[] objects = checkLeak.getAllObjects(clazz); + if (objects.length > maxExpected) { + for (Object obj : objects) { + logger.warn("Object {} still in the heap", obj); + } + String report = checkLeak.exploreObjectReferences(5, 10, true, objects); + logger.info(report); + + Assert.fail("Class " + clazz + " has leaked " + objects.length + " objects\n" + report); + } + } + +} diff --git a/tests/leak-tests/test.log b/tests/leak-tests/test.log new file mode 100644 index 0000000000..23360a6289 --- /dev/null +++ b/tests/leak-tests/test.log @@ -0,0 +1,140 @@ +[INFO] Scanning for projects... +[INFO] ------------------------------------------------------------------------ +[INFO] Detecting the operating system and CPU architecture +[INFO] ------------------------------------------------------------------------ +[INFO] os.detected.name: osx +[INFO] os.detected.arch: x86_64 +[INFO] os.detected.bitness: 64 +[INFO] os.detected.version: 10.16 +[INFO] os.detected.version.major: 10 +[INFO] os.detected.version.minor: 16 +[INFO] os.detected.classifier: osx-x86_64 +[INFO] +[INFO] ----------------< org.apache.activemq.tests:leak-tests >---------------- +[INFO] Building ActiveMQ Artemis Leak Tests 2.29.0-SNAPSHOT +[INFO] --------------------------------[ jar ]--------------------------------- +[INFO] +[INFO] --- maven-clean-plugin:3.2.0:clean (default-clean) @ leak-tests --- +[INFO] Deleting /Users/clebertsuconic/work/apache/activemq-artemis/tests/leak-tests/target +[INFO] +[INFO] --- maven-enforcer-plugin:3.1.0:enforce (enforce-maven-version) @ leak-tests --- +[INFO] +[INFO] --- maven-enforcer-plugin:3.1.0:enforce (enforce-java-version) @ leak-tests --- +[INFO] +[INFO] --- maven-resources-plugin:3.2.0:copy-resources (copy-security-resources) @ leak-tests --- +[INFO] Using 'UTF-8' encoding to copy filtered resources. +[INFO] Using 'UTF-8' encoding to copy filtered properties files. +[INFO] Copying 35 resources +[INFO] +[INFO] --- checkleak-maven-plugin:0.7:install (find-native) @ leak-tests --- +[INFO] +[INFO] --- maven-remote-resources-plugin:1.7.0:process (process-resource-bundles) @ leak-tests --- +[INFO] Preparing remote bundle org.apache:apache-jar-resource-bundle:1.4 +[INFO] Copying 3 resources from 1 bundle. +[INFO] +[INFO] --- maven-resources-plugin:3.2.0:resources (default-resources) @ leak-tests --- +[INFO] Using 'UTF-8' encoding to copy filtered resources. +[INFO] Using 'UTF-8' encoding to copy filtered properties files. +[INFO] skip non existing resourceDirectory /Users/clebertsuconic/work/apache/activemq-artemis/tests/leak-tests/src/main/resources +[INFO] Copying 3 resources +[INFO] +[INFO] --- maven-compiler-plugin:3.10.1:compile (default-compile) @ leak-tests --- +[INFO] No sources to compile +[INFO] +[INFO] --- maven-resources-plugin:3.2.0:testResources (default-testResources) @ leak-tests --- +[INFO] Using 'UTF-8' encoding to copy filtered resources. +[INFO] Using 'UTF-8' encoding to copy filtered properties files. +[INFO] skip non existing resourceDirectory /Users/clebertsuconic/work/apache/activemq-artemis/tests/leak-tests/src/test/resources +[INFO] Copying 3 resources +[INFO] +[INFO] --- maven-compiler-plugin:3.10.1:testCompile (default-testCompile) @ leak-tests --- +[INFO] Changes detected - recompiling the module! +[INFO] Compiling 2 source files to /Users/clebertsuconic/work/apache/activemq-artemis/tests/leak-tests/target/test-classes +[INFO] +[INFO] --- maven-surefire-plugin:2.22.2:test (default-test) @ leak-tests --- +[WARNING] The system property basedir is configured twice! The property appears in and any of , or user property. +[INFO] +[INFO] ------------------------------------------------------- +[INFO] T E S T S +[INFO] ------------------------------------------------------- +[INFO] Running org.apache.activemq.artemis.tests.leak.ConnectionLeakTest +[main] 14:39:26,380 INFO [org.apache.activemq.artemis.tests.util.ActiveMQTestBase] **** start #test testAMQP() *** +[main] 14:39:26,650 INFO [org.apache.activemq.artemis.core.server] AMQ221000: live Message Broker is starting with configuration Broker Configuration (clustered=false,journalDirectory=/Users/clebertsuconic/work/apache/activemq-artemis/tests/leak-tests/./target/tmp/ConnectionLeakTest/junit16008448135972800424/journal1-L,bindingsDirectory=/Users/clebertsuconic/work/apache/activemq-artemis/tests/leak-tests/./target/tmp/ConnectionLeakTest/junit16008448135972800424/bindings1-L,largeMessagesDirectory=/Users/clebertsuconic/work/apache/activemq-artemis/tests/leak-tests/./target/tmp/ConnectionLeakTest/junit16008448135972800424/large-msg1-L,pagingDirectory=/Users/clebertsuconic/work/apache/activemq-artemis/tests/leak-tests/./target/tmp/ConnectionLeakTest/junit16008448135972800424/page1-L) +[main] 14:39:26,679 INFO [org.apache.activemq.artemis.core.server] AMQ221013: Using NIO Journal +[main] 14:39:26,791 INFO [org.apache.activemq.artemis.core.server] AMQ221043: Protocol module found: [artemis-server]. Adding protocol support for: CORE +[main] 14:39:26,792 INFO [org.apache.activemq.artemis.core.server] AMQ221043: Protocol module found: [artemis-amqp-protocol]. Adding protocol support for: AMQP +[main] 14:39:26,792 INFO [org.apache.activemq.artemis.core.server] AMQ221043: Protocol module found: [artemis-stomp-protocol]. Adding protocol support for: STOMP +[main] 14:39:26,793 INFO [org.apache.activemq.artemis.core.server] AMQ221043: Protocol module found: [artemis-openwire-protocol]. Adding protocol support for: OPENWIRE +[main] 14:39:26,793 INFO [org.apache.activemq.artemis.core.server] AMQ221043: Protocol module found: [artemis-mqtt-protocol]. Adding protocol support for: MQTT +[main] 14:39:26,857 INFO [org.apache.activemq.artemis.core.server] AMQ221034: Waiting indefinitely to obtain live lock +[main] 14:39:26,857 INFO [org.apache.activemq.artemis.core.server] AMQ221035: Live Server Obtained live lock +[main] 14:39:27,445 INFO [org.apache.activemq.artemis.core.server] AMQ221020: Started KQUEUE Acceptor at localhost:61616 for protocols [CORE,MQTT,AMQP,STOMP,OPENWIRE] +[main] 14:39:27,464 INFO [org.apache.activemq.artemis.core.server] AMQ221007: Server is now live +[main] 14:39:27,464 INFO [org.apache.activemq.artemis.core.server] AMQ221001: Apache ActiveMQ Artemis Message Broker version 2.29.0-SNAPSHOT [localhost, nodeID=9f35d8ec-ae31-11ed-a464-3c22fb430ab3] +[AmqpProvider :(1):[amqp://localhost:61616]] 14:39:28,238 INFO [org.apache.qpid.jms.JmsConnection] Connection ID:e2a47639-2cff-419e-a456-6ebec189d2fd:1 connected to server: amqp://localhost:61616 +[AmqpProvider :(2):[amqp://localhost:61616]] 14:39:28,266 INFO [org.apache.qpid.jms.JmsConnection] Connection ID:7f0b3201-7ab3-48d4-b834-f026f6890c29:2 connected to server: amqp://localhost:61616 +[AmqpProvider :(3):[amqp://localhost:61616]] 14:39:29,587 INFO [org.apache.qpid.jms.JmsConnection] Connection ID:e840b858-2b58-4813-a749-f486f3a2f3f6:3 connected to server: amqp://localhost:61616 +[AmqpProvider :(4):[amqp://localhost:61616]] 14:39:29,704 WARN [org.apache.qpid.jms.provider.amqp.builders.AmqpResourceBuilder] Open of resource:(JmsConnectionInfo { ID:950c1cc8-36a5-4a56-a283-c800eaf43da2:4, configuredURI = amqp://localhost:61616, connectedURI = null }) failed: Open failed unexpectedly. +[Thread-3 (activemq-netty-threads)] 14:39:29,706 WARN [org.apache.activemq.artemis.core.server] AMQ222061: Client connection failed, clearing up resources for session a0fc19cd-ae31-11ed-a464-3c22fb430ab3 +[Thread-3 (activemq-netty-threads)] 14:39:29,706 WARN [org.apache.activemq.artemis.core.server] AMQ222107: Cleared up resources for session a0fc19cd-ae31-11ed-a464-3c22fb430ab3 +[main] 14:39:30,644 INFO [org.apache.activemq.artemis.core.server] AMQ221002: Apache ActiveMQ Artemis Message Broker version 2.29.0-SNAPSHOT [9f35d8ec-ae31-11ed-a464-3c22fb430ab3] stopped, uptime 4.065 seconds +[main] 14:39:30,766 INFO [org.apache.activemq.artemis.tests.util.ActiveMQTestBase] **** end #test testAMQP() *** +[main] 14:39:30,767 INFO [org.apache.activemq.artemis.tests.util.ActiveMQTestBase] **** start #test testCore() *** +[main] 14:39:30,812 INFO [org.apache.activemq.artemis.core.server] AMQ221000: live Message Broker is starting with configuration Broker Configuration (clustered=false,journalDirectory=/Users/clebertsuconic/work/apache/activemq-artemis/tests/leak-tests/./target/tmp/ConnectionLeakTest/junit8509090511689323465/journal1-L,bindingsDirectory=/Users/clebertsuconic/work/apache/activemq-artemis/tests/leak-tests/./target/tmp/ConnectionLeakTest/junit8509090511689323465/bindings1-L,largeMessagesDirectory=/Users/clebertsuconic/work/apache/activemq-artemis/tests/leak-tests/./target/tmp/ConnectionLeakTest/junit8509090511689323465/large-msg1-L,pagingDirectory=/Users/clebertsuconic/work/apache/activemq-artemis/tests/leak-tests/./target/tmp/ConnectionLeakTest/junit8509090511689323465/page1-L) +[main] 14:39:30,813 INFO [org.apache.activemq.artemis.core.server] AMQ221013: Using NIO Journal +[main] 14:39:30,813 INFO [org.apache.activemq.artemis.core.server] AMQ221043: Protocol module found: [artemis-server]. Adding protocol support for: CORE +[main] 14:39:30,814 INFO [org.apache.activemq.artemis.core.server] AMQ221043: Protocol module found: [artemis-amqp-protocol]. Adding protocol support for: AMQP +[main] 14:39:30,814 INFO [org.apache.activemq.artemis.core.server] AMQ221043: Protocol module found: [artemis-stomp-protocol]. Adding protocol support for: STOMP +[main] 14:39:30,815 INFO [org.apache.activemq.artemis.core.server] AMQ221043: Protocol module found: [artemis-openwire-protocol]. Adding protocol support for: OPENWIRE +[main] 14:39:30,815 INFO [org.apache.activemq.artemis.core.server] AMQ221043: Protocol module found: [artemis-mqtt-protocol]. Adding protocol support for: MQTT +[main] 14:39:30,844 INFO [org.apache.activemq.artemis.core.server] AMQ221034: Waiting indefinitely to obtain live lock +[main] 14:39:30,844 INFO [org.apache.activemq.artemis.core.server] AMQ221035: Live Server Obtained live lock +[main] 14:39:30,871 INFO [org.apache.activemq.artemis.core.server] AMQ221020: Started KQUEUE Acceptor at localhost:61616 for protocols [CORE,MQTT,AMQP,STOMP,OPENWIRE] +[main] 14:39:30,890 INFO [org.apache.activemq.artemis.core.server] AMQ221007: Server is now live +[main] 14:39:30,890 INFO [org.apache.activemq.artemis.core.server] AMQ221001: Apache ActiveMQ Artemis Message Broker version 2.29.0-SNAPSHOT [localhost, nodeID=a1b41f2f-ae31-11ed-a464-3c22fb430ab3] +[main] 14:39:33,361 INFO [org.apache.activemq.artemis.core.server] AMQ221002: Apache ActiveMQ Artemis Message Broker version 2.29.0-SNAPSHOT [a1b41f2f-ae31-11ed-a464-3c22fb430ab3] stopped, uptime 2.591 seconds +[main] 14:39:33,495 INFO [org.apache.activemq.artemis.tests.util.ActiveMQTestBase] **** end #test testCore() *** +[main] 14:39:33,496 INFO [org.apache.activemq.artemis.tests.util.ActiveMQTestBase] **** start #test testOpenWire() *** +[main] 14:39:33,538 INFO [org.apache.activemq.artemis.core.server] AMQ221000: live Message Broker is starting with configuration Broker Configuration (clustered=false,journalDirectory=/Users/clebertsuconic/work/apache/activemq-artemis/tests/leak-tests/./target/tmp/ConnectionLeakTest/junit11559466446765387077/journal1-L,bindingsDirectory=/Users/clebertsuconic/work/apache/activemq-artemis/tests/leak-tests/./target/tmp/ConnectionLeakTest/junit11559466446765387077/bindings1-L,largeMessagesDirectory=/Users/clebertsuconic/work/apache/activemq-artemis/tests/leak-tests/./target/tmp/ConnectionLeakTest/junit11559466446765387077/large-msg1-L,pagingDirectory=/Users/clebertsuconic/work/apache/activemq-artemis/tests/leak-tests/./target/tmp/ConnectionLeakTest/junit11559466446765387077/page1-L) +[main] 14:39:33,538 INFO [org.apache.activemq.artemis.core.server] AMQ221013: Using NIO Journal +[main] 14:39:33,539 INFO [org.apache.activemq.artemis.core.server] AMQ221043: Protocol module found: [artemis-server]. Adding protocol support for: CORE +[main] 14:39:33,539 INFO [org.apache.activemq.artemis.core.server] AMQ221043: Protocol module found: [artemis-amqp-protocol]. Adding protocol support for: AMQP +[main] 14:39:33,540 INFO [org.apache.activemq.artemis.core.server] AMQ221043: Protocol module found: [artemis-stomp-protocol]. Adding protocol support for: STOMP +[main] 14:39:33,541 INFO [org.apache.activemq.artemis.core.server] AMQ221043: Protocol module found: [artemis-openwire-protocol]. Adding protocol support for: OPENWIRE +[main] 14:39:33,541 INFO [org.apache.activemq.artemis.core.server] AMQ221043: Protocol module found: [artemis-mqtt-protocol]. Adding protocol support for: MQTT +[main] 14:39:33,566 INFO [org.apache.activemq.artemis.core.server] AMQ221034: Waiting indefinitely to obtain live lock +[main] 14:39:33,566 INFO [org.apache.activemq.artemis.core.server] AMQ221035: Live Server Obtained live lock +[main] 14:39:33,590 INFO [org.apache.activemq.artemis.core.server] AMQ221020: Started KQUEUE Acceptor at localhost:61616 for protocols [CORE,MQTT,AMQP,STOMP,OPENWIRE] +[main] 14:39:33,610 INFO [org.apache.activemq.artemis.core.server] AMQ221007: Server is now live +[main] 14:39:33,610 INFO [org.apache.activemq.artemis.core.server] AMQ221001: Apache ActiveMQ Artemis Message Broker version 2.29.0-SNAPSHOT [localhost, nodeID=a354130a-ae31-11ed-a464-3c22fb430ab3] +[main] 14:39:36,178 INFO [org.apache.activemq.artemis.core.server] AMQ221002: Apache ActiveMQ Artemis Message Broker version 2.29.0-SNAPSHOT [a354130a-ae31-11ed-a464-3c22fb430ab3] stopped, uptime 2.680 seconds +[main] 14:39:36,318 INFO [org.apache.activemq.artemis.tests.util.ActiveMQTestBase] **** end #test testOpenWire() *** +[INFO] Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 10.423 s - in org.apache.activemq.artemis.tests.leak.ConnectionLeakTest +[INFO] +[INFO] Results: +[INFO] +[INFO] Tests run: 3, Failures: 0, Errors: 0, Skipped: 0 +[INFO] +[INFO] +[INFO] --- maven-jar-plugin:3.2.2:jar (default-jar) @ leak-tests --- +[INFO] Building jar: /Users/clebertsuconic/work/apache/activemq-artemis/tests/leak-tests/target/leak-tests-2.29.0-SNAPSHOT.jar +[INFO] +[INFO] --- maven-site-plugin:3.12.0:attach-descriptor (attach-descriptor) @ leak-tests --- +[INFO] Skipping because packaging 'jar' is not pom. +[INFO] +[INFO] --- maven-source-plugin:3.2.1:jar-no-fork (attach-sources) @ leak-tests --- +[INFO] Building jar: /Users/clebertsuconic/work/apache/activemq-artemis/tests/leak-tests/target/leak-tests-2.29.0-SNAPSHOT-sources.jar +[INFO] +[INFO] --- dependency-check-maven:6.1.0:check (default) @ leak-tests --- +[INFO] Skipping dependency-check +[INFO] +[INFO] --- maven-install-plugin:2.5.2:install (default-install) @ leak-tests --- +[INFO] Installing /Users/clebertsuconic/work/apache/activemq-artemis/tests/leak-tests/target/leak-tests-2.29.0-SNAPSHOT.jar to /Users/clebertsuconic/.m2/repository/org/apache/activemq/tests/leak-tests/2.29.0-SNAPSHOT/leak-tests-2.29.0-SNAPSHOT.jar +[INFO] Installing /Users/clebertsuconic/work/apache/activemq-artemis/tests/leak-tests/pom.xml to /Users/clebertsuconic/.m2/repository/org/apache/activemq/tests/leak-tests/2.29.0-SNAPSHOT/leak-tests-2.29.0-SNAPSHOT.pom +[INFO] Installing /Users/clebertsuconic/work/apache/activemq-artemis/tests/leak-tests/target/leak-tests-2.29.0-SNAPSHOT-sources.jar to /Users/clebertsuconic/.m2/repository/org/apache/activemq/tests/leak-tests/2.29.0-SNAPSHOT/leak-tests-2.29.0-SNAPSHOT-sources.jar +[INFO] ------------------------------------------------------------------------ +[INFO] BUILD SUCCESS +[INFO] ------------------------------------------------------------------------ +[INFO] Total time: 16.564 s +[INFO] Finished at: 2023-02-16T14:39:37-05:00 +[INFO] ------------------------------------------------------------------------ diff --git a/tests/pom.xml b/tests/pom.xml index 32cd3c7357..d29feed0f8 100644 --- a/tests/pom.xml +++ b/tests/pom.xml @@ -139,5 +139,6 @@ artemis-test-support smoke-tests e2e-tests + leak-tests