[
https://issues.apache.org/jira/browse/ARTEMIS-2217?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16736734#comment-16736734
]
ASF GitHub Bot commented on ARTEMIS-2217:
-----------------------------------------
Github user onlyMIT commented on a diff in the pull request:
https://github.com/apache/activemq-artemis/pull/2491#discussion_r245878622
--- Diff:
artemis-protocols/artemis-mqtt-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/mqtt/MQTTSession.java
---
@@ -117,14 +118,11 @@ boolean getStopped() {
}
boolean isClean() {
- return isClean;
+ return clean;
}
- void setIsClean(boolean isClean) throws Exception {
- this.isClean = isClean;
- if (isClean) {
- clean();
- }
+ void setClean(boolean clean) throws Exception {
+ this.clean = clean;
--- End diff --
It is necessary to call the "clean()" method to clean up old session
information when creating a connection.
If it is not cleaned up, when the cleanSession of the last MQTT consumer is
false, and the cleanSession of the connected MQTT consumer is true, the message
in the old queue will be consumed, which is actually not allowed.
I think this is why calling "clean()" in the "setIsClean(boolean isClean)"
method
> ‘MQTTSessionState’ in the ‘SESSIONS ConcurrentHashMap’ never be removed
> -----------------------------------------------------------------------
>
> Key: ARTEMIS-2217
> URL: https://issues.apache.org/jira/browse/ARTEMIS-2217
> Project: ActiveMQ Artemis
> Issue Type: Bug
> Components: MQTT
> Affects Versions: 2.7.0
> Reporter: Shiping Liang
> Priority: Major
>
> ‘MQTTSessionState’ in the ‘SESSIONS ConcurrentHashMap’ should be removed when
> the conusmer (cleanSession is true) connection is closed
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)