activemq-artemis
activemq-artemis copied to clipboard
ARTEMIS-5780 ensure full MQTT session clean-up on restart
This commit ensures that MQTT 5 sessions using a session expiry interval of 0 are cleaned up after a broker restart. This includes:
- Serialized state message in the $sys.mqtt.sessions queue
- Any related $sys.mqtt.queue.qos2 queues
- Any related subscription queues
To be clear, we can't simply inspect the session expiry interval when the session is created and make subscription queues non-durable because the session expiry interval can be changed on the session with the DISCONNECT packet at which point it would be impossible to potentially make the queue durable and persist all the messages.
Seeing a repeatable failure in test:org.apache.activemq.artemis.tests.integration.mqtt5.MQTT5Test#testResumeSubscriptionsAfterRestart
org.opentest4j.AssertionFailedError: expected: <true> but was: <false>
at org.junit.jupiter.api.AssertionFailureBuilder.build(AssertionFailureBuilder.java:158)
at org.junit.jupiter.api.AssertionFailureBuilder.buildAndThrow(AssertionFailureBuilder.java:139)
at org.junit.jupiter.api.AssertTrue.failNotTrue(AssertTrue.java:69)
at org.junit.jupiter.api.AssertTrue.assertTrue(AssertTrue.java:41)
at org.junit.jupiter.api.AssertTrue.assertTrue(AssertTrue.java:35)
at org.junit.jupiter.api.Assertions.assertTrue(Assertions.java:195)
at org.apache.activemq.artemis.tests.integration.mqtt5.MQTT5Test.testResumeSubscriptionsAfterRestart(MQTT5Test.java:235)