Uploaded image for project: 'AMQ Broker'
  1. AMQ Broker
  2. ENTMQBR-1867

Integration test QueueControlTest#testGetFirstMessage sometimes fails with NPE

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Icon: Major Major
    • None
    • Future GA
    • management, testing
    • Hide

      Run the test in question until failure, using the preset in IntelliJ.

      Show
      Run the test in question until failure, using the preset in IntelliJ.

      The test org.apache.activemq.artemis.tests.integration.management.QueueControlTest#testGetFirstMessage[durable=false] does occasionally fail with an NPE. The failure rate is about 1 in 500 executions. (It used to be more frequent in a checkout from last week.)

      The weird thing is that the queueControl variable seems to become null due to activity of some thread in the background, while the test is doing its own thing. The println succeeded, but the call after that did not.

      [...]
            // It's empty, so it's supposed to be like this
            assertEquals("[{}]", queueControl.getFirstMessageAsJSON());
      
            long beforeSend = System.currentTimeMillis();
            ClientProducer producer = session.createProducer(address);
            producer.send(session.createMessage(false).putStringProperty("x", "valueX").putStringProperty("y", "valueY"));
      
            System.out.println("first:" + queueControl.getFirstMessageAsJSON());
      
            long firstMessageTimestamp = queueControl.getFirstMessageTimestamp();  // <--- NPE here
      [...]
      
      [main] 18:39:24,062 INFO  [org.apache.activemq.artemis.core.server] **** start #test testGetFirstMessage[durable=false]() ***
      [main] 18:39:24,063 INFO  [org.apache.activemq.artemis.core.server] AMQ221000: live Message Broker is starting with configuration Broker Configuration (clustered=false,journalDirectory=/home/jdanek/Work/repos/activemq-artemis/tests/integration-tests/./target/tmp/junit6121931814512757719/journal0-L,bindingsDirectory=/home/jdanek/Work/repos/activemq-artemis/tests/integration-tests/./target/tmp/junit6121931814512757719/bindings0-L,largeMessagesDirectory=/home/jdanek/Work/repos/activemq-artemis/tests/integration-tests/./target/tmp/junit6121931814512757719/large-msg0-L,pagingDirectory=/home/jdanek/Work/repos/activemq-artemis/tests/integration-tests/./target/tmp/junit6121931814512757719/page0-L)
      [main] 18:39:24,063 INFO  [org.apache.activemq.artemis.core.server] AMQ221043: Protocol module found: [artemis-server]. Adding protocol support for: CORE
      [main] 18:39:24,063 INFO  [org.apache.activemq.artemis.core.server] AMQ221043: Protocol module found: [artemis-amqp-protocol]. Adding protocol support for: AMQP
      [main] 18:39:24,063 INFO  [org.apache.activemq.artemis.core.server] AMQ221043: Protocol module found: [artemis-stomp-protocol]. Adding protocol support for: STOMP
      [main] 18:39:24,063 INFO  [org.apache.activemq.artemis.core.server] AMQ221043: Protocol module found: [artemis-openwire-protocol]. Adding protocol support for: OPENWIRE
      [main] 18:39:24,064 INFO  [org.apache.activemq.artemis.core.server] AMQ221043: Protocol module found: [artemis-hornetq-protocol]. Adding protocol support for: HORNETQ
      [main] 18:39:24,064 INFO  [org.apache.activemq.artemis.core.server] AMQ221043: Protocol module found: [artemis-mqtt-protocol]. Adding protocol support for: MQTT
      [main] 18:39:24,067 INFO  [org.apache.activemq.artemis.core.server] AMQ221007: Server is now live
      [main] 18:39:24,067 INFO  [org.apache.activemq.artemis.core.server] AMQ221001: Apache ActiveMQ Artemis Message Broker version 2.7.0-SNAPSHOT [localhost, nodeID=7125a371-9a60-11e8-94a9-a6b1a7c8b6a3] 
      first:[{}]
      [main] 18:39:24,076 INFO  [org.apache.activemq.artemis.core.server] AMQ221002: Apache ActiveMQ Artemis Message Broker version 2.7.0-SNAPSHOT [7125a371-9a60-11e8-94a9-a6b1a7c8b6a3] stopped, uptime 0.013 seconds
      [main] 18:39:24,077 INFO  [org.apache.activemq.artemis.core.server] **** end #test testGetFirstMessage[durable=false]() ***
      
      java.lang.NullPointerException
      	at org.apache.activemq.artemis.tests.integration.management.QueueControlTest.testGetFirstMessage(QueueControlTest.java:313)
      	at sun.reflect.GeneratedMethodAccessor5.invoke(Unknown Source)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:498)
      	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
      	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
      	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
      	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
      	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
      	at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
      	at org.junit.rules.TestWatcher$1.evaluate(TestWatcher.java:55)
      	at org.junit.rules.ExternalResource$1.evaluate(ExternalResource.java:48)
      	at org.junit.rules.TestWatcher$1.evaluate(TestWatcher.java:55)
      	at org.junit.rules.ExternalResource$1.evaluate(ExternalResource.java:48)
      	at org.junit.rules.ExternalResource$1.evaluate(ExternalResource.java:48)
      	at org.junit.rules.TestWatcher$1.evaluate(TestWatcher.java:55)
      	at org.junit.rules.RunRules.evaluate(RunRules.java:20)
      	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
      	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
      	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
      	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
      	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
      	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
      	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
      	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
      	at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
      	at org.junit.runners.Suite.runChild(Suite.java:127)
      	at org.junit.runners.Suite.runChild(Suite.java:26)
      	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
      	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
      	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
      	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
      	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
      	at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
      	at org.junit.runner.JUnitCore.run(JUnitCore.java:160)
      	at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
      	at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:67)
      	at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
      	at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
      

              rh-ee-ataylor Andy Taylor
              jdanek@redhat.com Jiri Daněk
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: