Uploaded image for project: 'ActiveMQ Artemis'
  1. ActiveMQ Artemis
  2. ARTEMIS-2782

MQTT connection failure handling may lead to NPE

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Not A Problem
    • 2.11.0
    • None
    • None
    • None

    Description

      Our (EnMasse) automated test suite includes some MQTT use-cases that rely on Artemis's native  MQTT support.  A recent test run failed as follows:

      2020-05-26T05:04:21.293Z INFO  [message] AMQ601500: User test is sending a core message on target resource: ServerSessionImpl() [with parameters: [null, org.apache.activemq.artemis.protocol.amqp.broker.AMQPMessage@50b01c3e, true, false, RoutingContextImpl(Address=jmsTopicDurSubs, routingType=MULTICAST, PreviousAddress=jmsTopicDurSubs previousRoute:MULTICAST, reusable=true, version=-2147470526)
      2020-05-26T05:04:21.293Z INFO  [message] AMQ601500: User test is sending a core message on target resource: ServerSessionImpl() [with parameters: [null, org.apache.activemq.artemis.protocol.amqp.broker.AMQPMessage@50b01c3e, true, false, RoutingContextImpl(Address=jmsTopicDurSubs, routingType=MULTICAST, PreviousAddress=jmsTopicDurSubs previousRoute:MULTICAST, reusable=true, version=-2147470526)..................................................***** durable queues jmsTopicDurSubs:- queueID=279451 address:jmsTopicDurSubs name:jmsCliId.sub1DurSub filter:null- queueID=279456 address:jmsTopicDurSubs name:jmsCliId.sub2DurSub filter:null***** non durable for jmsTopicDurSubs:Exception in thread "Thread-10" java.lang.NullPointerException
       at org.apache.activemq.artemis.core.protocol.mqtt.MQTTConnectionManager.disconnect(MQTTConnectionManager.java:146)
       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:149)
       at org.apache.activemq.artemis.core.remoting.server.impl.RemotingServiceImpl.issueFailure(RemotingServiceImpl.java:572)
       at org.apache.activemq.artemis.core.remoting.server.impl.RemotingServiceImpl.connectionException(RemotingServiceImpl.java:578)
       at org.apache.activemq.artemis.core.remoting.impl.netty.NettyAcceptor$Listener$1.run(NettyAcceptor.java:920)
      

       

      I don't understand the root cause that caused the  MQTT connection to be closed, but the stack trace highlights a problem in the error handlng in MQTTConnectionManager.disconnect.  If the session.getSessionState() returns null, as synchronising on a null is disallowed,  the method will end with a NPE exception.  

      Attachments

        Activity

          People

            Unassigned Unassigned
            kwall Keith Wall
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: