Erich Duda created ARTEMIS-606:
----------------------------------

             Summary: [Artemis Testsuite] 
JMSServerControl2Test#testCloseConsumerConnectionsForAddressForInVM fails
                 Key: ARTEMIS-606
                 URL: https://issues.apache.org/jira/browse/ARTEMIS-606
             Project: ActiveMQ Artemis
          Issue Type: Bug
    Affects Versions: 1.3.0
            Reporter: Erich Duda


{code}
java.lang.AssertionError: did not received the expected JMSException
        at org.junit.Assert.fail(Assert.java:88)
        at org.junit.Assert.assertTrue(Assert.java:41)
        at 
org.apache.activemq.artemis.tests.integration.jms.server.management.JMSServerControl2Test.doCloseConnectionsForUser(JMSServerControl2Test.java:1136)
        at 
org.apache.activemq.artemis.tests.integration.jms.server.management.JMSServerControl2Test.testCloseConnectionsForUserForInVM(JMSServerControl2Test.java:143)
{code}

{code}
11:49:34,359 INFO  [org.apache.activemq.artemis.core.server] #*#*# Starting 
test: testCloseConnectionsForUserForInVM()...
#test testCloseConnectionsForUserForInVM
11:49:34,394 INFO  [org.apache.activemq.artemis.core.server] AMQ221000: live 
Message Broker is starting with configuration Broker Configuration 
(clustered=false,journalDirectory=/mnt/hudson_workspace/workspace/eap-70x-artemis-project-testsuite-rhel/NATIVES/true/jdk/ibm1.8/label/EAP-RHEL7/activemq-artemis/tests/integration-tests/./target/tmp/junit2245767348249816620/journal,bindingsDirectory=/mnt/hudson_workspace/workspace/eap-70x-artemis-project-testsuite-rhel/NATIVES/true/jdk/ibm1.8/label/EAP-RHEL7/activemq-artemis/tests/integration-tests/./target/tmp/junit2245767348249816620/bindings,largeMessagesDirectory=/mnt/hudson_workspace/workspace/eap-70x-artemis-project-testsuite-rhel/NATIVES/true/jdk/ibm1.8/label/EAP-RHEL7/activemq-artemis/tests/integration-tests/./target/tmp/junit2245767348249816620/large-msg,pagingDirectory=/mnt/hudson_workspace/workspace/eap-70x-artemis-project-testsuite-rhel/NATIVES/true/jdk/ibm1.8/label/EAP-RHEL7/activemq-artemis/tests/integration-tests/./target/tmp/junit2245767348249816620/page)
11:49:34,395 INFO  [org.apache.activemq.artemis.core.server] AMQ221012: Using 
AIO Journal
11:49:34,397 INFO  [org.apache.activemq.artemis.core.server] AMQ221043: 
Protocol module found: [artemis-server]. Adding protocol support for: CORE
11:49:34,399 INFO  [org.apache.activemq.artemis.core.server] AMQ221043: 
Protocol module found: [artemis-amqp-protocol]. Adding protocol support for: 
AMQP
11:49:34,400 INFO  [org.apache.activemq.artemis.core.server] AMQ221043: 
Protocol module found: [artemis-stomp-protocol]. Adding protocol support for: 
STOMP
11:49:34,401 INFO  [org.apache.activemq.artemis.core.server] AMQ221043: 
Protocol module found: [artemis-openwire-protocol]. Adding protocol support 
for: OPENWIRE
11:49:34,403 INFO  [org.apache.activemq.artemis.core.server] AMQ221043: 
Protocol module found: [artemis-hornetq-protocol]. Adding protocol support for: 
HORNETQ
11:49:34,404 INFO  [org.apache.activemq.artemis.core.server] AMQ221043: 
Protocol module found: [artemis-mqtt-protocol]. Adding protocol support for: 
MQTT
11:49:34,506 INFO  [org.apache.activemq.artemis.core.server] AMQ221007: Server 
is now live
11:49:34,506 INFO  [org.apache.activemq.artemis.core.server] AMQ221001: Apache 
ActiveMQ Artemis Message Broker version 1.1.0.jboss-SNAPSHOT 
[nodeID=e915a1c8-3d47-11e6-a0a1-3172e2bd12af] 
11:49:34,606 INFO  [org.apache.activemq.artemis.core.server] AMQ221003: trying 
to deploy queue jms.queue.97c12b14-0a31-4cb8-a1ad-5ba0217abb5f
11:49:34,650 INFO  [org.apache.activemq.artemis.core.server] AMQ221003: trying 
to deploy queue jms.queue.66bdf106-b409-4e3c-b70b-d9918ea812c3
11:49:34,830 WARN  [org.apache.activemq.artemis.core.client] AMQ212037: 
Connection failure has been detected: AMQ119108: connections for user fakeUser 
closed by management [code=INTERNAL_ERROR]
11:49:34,830 WARN  [org.apache.activemq.artemis.core.server] AMQ222061: Client 
connection failed, clearing up resources for session 
e94bcd00-3d47-11e6-a0a1-3172e2bd12af
11:49:34,831 WARN  [org.apache.activemq.artemis.core.server] AMQ222107: Cleared 
up resources for session e94bcd00-3d47-11e6-a0a1-3172e2bd12af
11:49:34,846 WARN  [org.apache.activemq.artemis.core.server] AMQ222061: Client 
connection failed, clearing up resources for session 
e94f9d91-3d47-11e6-a0a1-3172e2bd12af
11:49:34,848 WARN  [org.apache.activemq.artemis.core.server] AMQ222107: Cleared 
up resources for session e94f9d91-3d47-11e6-a0a1-3172e2bd12af
11:49:34,853 WARN  [org.apache.activemq.artemis.jms.client] AMQ122000: I''m 
closing a JMS connection you left open. Please make sure you close all JMS 
connections explicitly before letting them go out of scope! see stacktrace to 
find out where it was created: java.lang.Exception
        at 
org.apache.activemq.artemis.jms.client.ActiveMQConnection.<init>(ActiveMQConnection.java:155)
 [:]
        at 
org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory.createConnectionInternal(ActiveMQConnectionFactory.java:750)
 [:]
        at 
org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory.createConnection(ActiveMQConnectionFactory.java:233)
 [:]
        at 
org.apache.activemq.artemis.tests.integration.jms.server.management.JMSServerControl2Test.doCloseConnectionsForUser(JMSServerControl2Test.java:1110)
 [:]
        at 
org.apache.activemq.artemis.tests.integration.jms.server.management.JMSServerControl2Test.testCloseConnectionsForUserForInVM(JMSServerControl2Test.java:143)
 [:]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
[rt.jar:1.8.0-internal]
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:95) 
[rt.jar:1.8.0-internal]
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55)
 [rt.jar:1.8.0-internal]
        at java.lang.reflect.Method.invoke(Method.java:508) [rt.jar:2.6 
(04-27-2016)]
        at 
org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
 [junit-4.11.jar:]
        at 
org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
 [junit-4.11.jar:]
        at 
org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
 [junit-4.11.jar:]
        at 
org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
 [junit-4.11.jar:]
        at 
org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26) 
[junit-4.11.jar:]
        at 
org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27) 
[junit-4.11.jar:]
        at 
org.junit.rules.ExternalResource$1.evaluate(ExternalResource.java:48) 
[junit-4.11.jar:]
        at org.junit.rules.TestWatcher$1.evaluate(TestWatcher.java:55) 
[junit-4.11.jar:]
        at 
org.junit.rules.ExternalResource$1.evaluate(ExternalResource.java:48) 
[junit-4.11.jar:]
        at 
org.junit.rules.ExternalResource$1.evaluate(ExternalResource.java:48) 
[junit-4.11.jar:]
        at org.junit.rules.TestWatcher$1.evaluate(TestWatcher.java:55) 
[junit-4.11.jar:]
        at org.junit.rules.RunRules.evaluate(RunRules.java:20) [junit-4.11.jar:]
        at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271) 
[junit-4.11.jar:]
        at 
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
 [junit-4.11.jar:]
        at 
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
 [junit-4.11.jar:]
        at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238) 
[junit-4.11.jar:]
        at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63) 
[junit-4.11.jar:]
        at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236) 
[junit-4.11.jar:]
        at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53) 
[junit-4.11.jar:]
        at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229) 
[junit-4.11.jar:]
        at org.junit.runners.ParentRunner.run(ParentRunner.java:309) 
[junit-4.11.jar:]
        at 
org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:283)
 [surefire-junit4-2.18.1.jar:2.18.1]
        at 
org.apache.maven.surefire.junit4.JUnit4Provider.executeWithRerun(JUnit4Provider.java:173)
 [surefire-junit4-2.18.1.jar:2.18.1]
        at 
org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:153)
 [surefire-junit4-2.18.1.jar:2.18.1]
        at 
org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:128) 
[surefire-junit4-2.18.1.jar:2.18.1]
        at 
org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:203)
 [surefire-booter-2.18.1.jar:2.18.1]
        at 
org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:155)
 [surefire-booter-2.18.1.jar:2.18.1]
        at 
org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:103) 
[surefire-booter-2.18.1.jar:2.18.1]
{code}

Based on log it is clear that connection was closed by {{Finalizer}} before the 
failure was caused by the test itself. Since {{connection}} variable is not 
referenced in the code anymore, JVM concludes it can destroy the object. 
Especially IBM JDK does it very fast.

{code}
...
Session session = connection.createSession();
MessageConsumer messageConsumer = session.createConsumer(queue);

Connection connection2 = cf.createConnection();
Session session2 = connection2.createSession();
MessageConsumer messageConsumer2 = session2.createConsumer(queue2);

Assert.assertEquals(2, server.getConnectionCount());

String[] remoteAddresses = control.listRemoteAddresses();
Assert.assertEquals(2, remoteAddresses.length);

Assert.assertEquals(1, queueControl.getConsumerCount());
Assert.assertEquals(1, queueControl2.getConsumerCount());

final CountDownLatch exceptionLatch = new CountDownLatch(1);
connection.setExceptionListener(new ExceptionListener() {
      @Override
      public void onException(final JMSException e) {
         exceptionLatch.countDown();
      }
});
...
// connection is not referenced anymore -> connection.finalize()
{code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to