[
https://issues.apache.org/jira/browse/ARTEMIS-5575?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18005196#comment-18005196
]
ASF subversion and git services commented on ARTEMIS-5575:
----------------------------------------------------------
Commit 2fd0e96ed93b20d53b0a9dac1921048e9fbd80ab in activemq-artemis's branch
refs/heads/main from Justin Bertram
[ https://gitbox.apache.org/repos/asf?p=activemq-artemis.git;h=2fd0e96ed9 ]
ARTEMIS-5575 fix potential NPE during MQTT link stealing
This is a straight-forward fix for a race condition between checking if
the key exists in the map and then fetching the value of that key.
There's no test with this fix. Existing tests provide sufficient
coverage.
> Potential NPE during MQTT link stealing
> ---------------------------------------
>
> Key: ARTEMIS-5575
> URL: https://issues.apache.org/jira/browse/ARTEMIS-5575
> Project: ActiveMQ Artemis
> Issue Type: Bug
> Reporter: Justin Bertram
> Assignee: Justin Bertram
> Priority: Major
> Labels: pull-request-available
> Time Spent: 20m
> Remaining Estimate: 0h
>
> There's a potential NPE due to a race condition in the logic handling MQTT
> link stealing that I recently saw in the test-suite. Here's the exception:
> {noformat}
> ERROR [org.apache.activemq.artemis.core.protocol.mqtt] AMQ834002: Error
> processing control packet:
> MqttConnectMessage[fixedHeader=MqttFixedHeader[messageType=CONNECT,
> isDup=false, qosLevel=AT_MOST_ONCE, isRetain=false, remainingLength=21],
> variableHeader=MqttConnectVariableHeader[name=MQTT, version=4,
> hasUserName=false, hasPassword=false, isWillRetain=false, isWillFlag=false,
> isCleanSession=false, keepAliveTimeSeconds=1],
> payload=MqttConnectPayload[clientIdentifier=reconnect, willTopic=null,
> willMessage=null, userName=null, password=null]]
> java.lang.NullPointerException: Cannot invoke
> "org.apache.activemq.artemis.core.protocol.mqtt.MQTTConnection.getRemoteAddress()"
> because "existingConnection" is null
> at
> org.apache.activemq.artemis.core.protocol.mqtt.MQTTProtocolHandler.handleLinkStealing(MQTTProtocolHandler.java:493)
> at
> org.apache.activemq.artemis.core.protocol.mqtt.MQTTProtocolHandler.handleConnect(MQTTProtocolHandler.java:258)
> at
> org.apache.activemq.artemis.core.protocol.mqtt.MQTTProtocolHandler.act(MQTTProtocolHandler.java:161)
> at org.apache.activemq.artemis.utils.actors.Actor.doTask(Actor.java:32)
> at
> org.apache.activemq.artemis.utils.actors.ProcessorBase.executePendingTasks(ProcessorBase.java:69)
> at
> java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
> at
> java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
> at
> org.apache.activemq.artemis.utils.ActiveMQThreadFactory$1.run(ActiveMQThreadFactory.java:120){noformat}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information, visit: https://activemq.apache.org/contact