You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@activemq.apache.org by "ASF subversion and git services (Jira)" <ji...@apache.org> on 2022/06/14 18:49:00 UTC

[jira] [Commented] (ARTEMIS-3851) MQTT subscription queues exist after restart despite CleanSession=1

    [ https://issues.apache.org/jira/browse/ARTEMIS-3851?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17554248#comment-17554248 ] 

ASF subversion and git services commented on ARTEMIS-3851:
----------------------------------------------------------

Commit c9208aafda81e15c31bbcda3a99557f3fa29dd09 in activemq-artemis's branch refs/heads/main from Justin Bertram
[ https://gitbox.apache.org/repos/asf?p=activemq-artemis.git;h=c9208aafda ]

ARTEMIS-3851 MQTT sub q exists after restart despite CleanSession=1

MQTT 3.1 and 3.1.1 clients using a clean session should have a
*non-durable* subscription queue. If the broker restarts the queue
should be removed. This is due to [MQTT-3.1.2-6] which states that the
session (and any state) must last only as long as the network
connection.


> MQTT subscription queues exist after restart despite CleanSession=1
> -------------------------------------------------------------------
>
>                 Key: ARTEMIS-3851
>                 URL: https://issues.apache.org/jira/browse/ARTEMIS-3851
>             Project: ActiveMQ Artemis
>          Issue Type: Bug
>            Reporter: Justin Bertram
>            Assignee: Justin Bertram
>            Priority: Major
>          Time Spent: 0.5h
>  Remaining Estimate: 0h
>
> MQTT subscription queues are not cleaned up if the broker goes down while the consumer is connected.
> To reproduce the issue:
> # Run AMQ broker with standard configuration (addresses and queues are auto-created)
> # Run a MQTT consumer connecting to the target topic with {{CleanSession=true}}. At this point a subscription queue will be created on the address for the MQTT topic.
> # Run a MQTT producer sending messages into the target topic.
> # Since the producer is running, the consumer is receiving the messages.
> # Shutdown AMQ (it can be done gracefully or by killing -9 it).
> # Stop the MQTT producer.
> # Stop the MQTT consumer
> # Start the broker. After it is restarted, the old queue associated to the MQTT consumer is still there and it's not deleted.
> # Run again the MQTT producer. The broker continues enqueuing messages into the old subscription queue.
> # Stop the MQTT producer. The queue stops growing but it's still there with messages inside.
> The MQTT 3.1.1 specification states in [section 3.1.2.4|http://docs.oasis-open.org/mqtt/mqtt/v3.1.1/os/mqtt-v3.1.1-os.html#_Toc398718030]:
> bq. If CleanSession is set to 1, the Client and Server MUST discard any previous Session and start a new one. This Session lasts as long as the Network Connection. State data associated with this Session MUST NOT be reused in any subsequent Session [MQTT-3.1.2-6].
> When the broker is stopped the network connection is terminated so the session's state data (including any messages for any subscriptions) should be removed.
> To be clear, this works differently in MQTT 5 where {{CleanSession}} became {{CleanStart}} and session expiry interval was added.



--
This message was sent by Atlassian Jira
(v8.20.7#820007)