[
https://issues.apache.org/jira/browse/ARTEMIS-3851?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Justin Bertram updated ARTEMIS-3851:
------------------------------------
Description:
Queues are not cleaned up if the broker goes down whilst consumers are 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.
was:
Queues are not cleaned up if the broker goes down whilst consumers are 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.
> 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
>
> Queues are not cleaned up if the broker goes down whilst consumers are
> 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)