Keith Wall created ARTEMIS-2782:
-----------------------------------

             Summary: MQTT connection failure handling may leads to NPE
                 Key: ARTEMIS-2782
                 URL: https://issues.apache.org/jira/browse/ARTEMIS-2782
             Project: ActiveMQ Artemis
          Issue Type: Bug
    Affects Versions: 2.11.0
            Reporter: Keith Wall


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.  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to