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

Justin Bertram commented on ARTEMIS-4542:
-----------------------------------------

By default the broker will write state information to the journal on every 
successful MQTT connection. I've sent a commit to disable this so instead it 
only writes state information to the journal when subscriptions are created or 
destroyed. The commit also makes the timeout configurable and updates the 
documentation with additional information about how to disable session 
persistence completely.

> "Error disconnecting client" after connecting and disconnecting a few times
> ---------------------------------------------------------------------------
>
>                 Key: ARTEMIS-4542
>                 URL: https://issues.apache.org/jira/browse/ARTEMIS-4542
>             Project: ActiveMQ Artemis
>          Issue Type: Bug
>    Affects Versions: 2.31.0
>            Reporter: Daniel Martin
>            Assignee: Justin Bertram
>            Priority: Major
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> During some local tests which involved manually disconnecting and 
> reconnecting one MQTT client, at one point the ability to (re)connect was 
> lost, while the MQTT server kept printing the following message:
> {noformat}
> 2023-12-19 16:09:35,105 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=81], 
> variableHeader=MqttConnectVariableHeader[name=MQTT, version=5, 
> hasUserName=true, hasPassword=true, isWillRetain=false, isWillFlag=false, 
> isCleanSession=false, keepAliveTimeSeconds=60], 
> payload=MqttConnectPayload[clientIdentifier=99778aca-86a8-4b3e-84b9-74778c77e0e1,
>  willTopic=null, willMessage=null, userName=artemis, password=[...]]]
> java.lang.IllegalStateException: AMQ850000: Unable to store MQTT state within 
> given timeout: 5000ms
>      at 
> org.apache.activemq.artemis.core.protocol.mqtt.MQTTStateManager.storeSessionState(MQTTStateManager.java:177)
>  ~[artemis-mqtt-protocol-2.31.0.jar:2.31.0]
>      at 
> org.apache.activemq.artemis.core.protocol.mqtt.MQTTStateManager.getSessionState(MQTTStateManager.java:130)
>  ~[artemis-mqtt-protocol-2.31.0.jar:2.31.0]
>      at 
> org.apache.activemq.artemis.core.protocol.mqtt.MQTTConnectionManager.getSessionState(MQTTConnectionManager.java:206)
>  ~[artemis-mqtt-protocol-2.31.0.jar:2.31.0]
>      at 
> org.apache.activemq.artemis.core.protocol.mqtt.MQTTConnectionManager.connect(MQTTConnectionManager.java:71)
>  ~[artemis-mqtt-protocol-2.31.0.jar:2.31.0]
>      at 
> org.apache.activemq.artemis.core.protocol.mqtt.MQTTProtocolHandler.handleConnect(MQTTProtocolHandler.java:267)
>  ~[artemis-mqtt-protocol-2.31.0.jar:2.31.0]
>      at 
> org.apache.activemq.artemis.core.protocol.mqtt.MQTTProtocolHandler.act(MQTTProtocolHandler.java:159)
>  ~[artemis-mqtt-protocol-2.31.0.jar:2.31.0]
>      at org.apache.activemq.artemis.utils.actors.Actor.doTask(Actor.java:32) 
> ~[artemis-commons-2.31.0.jar:?]
>      at 
> org.apache.activemq.artemis.utils.actors.ProcessorBase.executePendingTasks(ProcessorBase.java:68)
>  ~[artemis-commons-2.31.0.jar:?]
>      at 
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
>  [?:?]
>      at 
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
>  [?:?]
>      at 
> org.apache.activemq.artemis.utils.ActiveMQThreadFactory$1.run(ActiveMQThreadFactory.java:118)
>  [artemis-commons-2.31.0.jar:?]
> 2023-12-19 16:09:40,105 ERROR 
> [org.apache.activemq.artemis.core.protocol.mqtt] AMQ834001: Error 
> disconnecting client.
> java.lang.IllegalStateException: AMQ850000: Unable to store MQTT state within 
> given timeout: 5000ms
>      at 
> org.apache.activemq.artemis.core.protocol.mqtt.MQTTStateManager.storeSessionState(MQTTStateManager.java:177)
>  ~[artemis-mqtt-protocol-2.31.0.jar:2.31.0]
>      at 
> org.apache.activemq.artemis.core.protocol.mqtt.MQTTSubscriptionManager.removeSubscriptions(MQTTSubscriptionManager.java:291)
>  ~[artemis-mqtt-protocol-2.31.0.jar:2.31.0]
>      at 
> org.apache.activemq.artemis.core.protocol.mqtt.MQTTSubscriptionManager.clean(MQTTSubscriptionManager.java:368)
>  ~[artemis-mqtt-protocol-2.31.0.jar:2.31.0]
>      at 
> org.apache.activemq.artemis.core.protocol.mqtt.MQTTSession.clean(MQTTSession.java:233)
>  ~[artemis-mqtt-protocol-2.31.0.jar:2.31.0]
>      at 
> org.apache.activemq.artemis.core.protocol.mqtt.MQTTSession.stop(MQTTSession.java:136)
>  ~[artemis-mqtt-protocol-2.31.0.jar:2.31.0]
>      at 
> org.apache.activemq.artemis.core.protocol.mqtt.MQTTConnectionManager.disconnect(MQTTConnectionManager.java:186)
>  ~[artemis-mqtt-protocol-2.31.0.jar:2.31.0]
>      at 
> org.apache.activemq.artemis.core.protocol.mqtt.MQTTProtocolHandler.disconnect(MQTTProtocolHandler.java:282)
>  ~[artemis-mqtt-protocol-2.31.0.jar:2.31.0]
>      at 
> org.apache.activemq.artemis.core.protocol.mqtt.MQTTProtocolHandler.act(MQTTProtocolHandler.java:183)
>  ~[artemis-mqtt-protocol-2.31.0.jar:2.31.0]
>      at org.apache.activemq.artemis.utils.actors.Actor.doTask(Actor.java:32) 
> ~[artemis-commons-2.31.0.jar:?]
>      at 
> org.apache.activemq.artemis.utils.actors.ProcessorBase.executePendingTasks(ProcessorBase.java:68)
>  ~[artemis-commons-2.31.0.jar:?]
>      at 
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
>  [?:?]
>      at 
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
>  [?:?]
>      at 
> org.apache.activemq.artemis.utils.ActiveMQThreadFactory$1.run(ActiveMQThreadFactory.java:118)
>  [artemis-commons-2.31.0.jar:?]
> 2023-12-19 16:09:45,106 ERROR 
> [org.apache.activemq.artemis.core.protocol.mqtt] AMQ834001: Error 
> disconnecting client.
> java.lang.IllegalStateException: AMQ850000: Unable to store MQTT state within 
> given timeout: 5000ms
>      at 
> org.apache.activemq.artemis.core.protocol.mqtt.MQTTStateManager.storeSessionState(MQTTStateManager.java:177)
>  ~[artemis-mqtt-protocol-2.31.0.jar:2.31.0]
>      at 
> org.apache.activemq.artemis.core.protocol.mqtt.MQTTSubscriptionManager.removeSubscriptions(MQTTSubscriptionManager.java:291)
>  ~[artemis-mqtt-protocol-2.31.0.jar:2.31.0]
>      at 
> org.apache.activemq.artemis.core.protocol.mqtt.MQTTSubscriptionManager.clean(MQTTSubscriptionManager.java:368)
>  ~[artemis-mqtt-protocol-2.31.0.jar:2.31.0]
>      at 
> org.apache.activemq.artemis.core.protocol.mqtt.MQTTSession.clean(MQTTSession.java:233)
>  ~[artemis-mqtt-protocol-2.31.0.jar:2.31.0]
>      at 
> org.apache.activemq.artemis.core.protocol.mqtt.MQTTSession.stop(MQTTSession.java:136)
>  ~[artemis-mqtt-protocol-2.31.0.jar:2.31.0]
>      at 
> org.apache.activemq.artemis.core.protocol.mqtt.MQTTConnectionManager.disconnect(MQTTConnectionManager.java:186)
>  ~[artemis-mqtt-protocol-2.31.0.jar:2.31.0]
>      at 
> org.apache.activemq.artemis.core.protocol.mqtt.MQTTProtocolHandler.disconnect(MQTTProtocolHandler.java:282)
>  ~[artemis-mqtt-protocol-2.31.0.jar:2.31.0]
>      at 
> org.apache.activemq.artemis.core.protocol.mqtt.MQTTProtocolHandler.disconnect(MQTTProtocolHandler.java:272)
>  ~[artemis-mqtt-protocol-2.31.0.jar:2.31.0]
>      at 
> org.apache.activemq.artemis.core.protocol.mqtt.MQTTProtocolHandler.act(MQTTProtocolHandler.java:198)
>  ~[artemis-mqtt-protocol-2.31.0.jar:2.31.0]
>      at org.apache.activemq.artemis.utils.actors.Actor.doTask(Actor.java:32) 
> ~[artemis-commons-2.31.0.jar:?]
>      at 
> org.apache.activemq.artemis.utils.actors.ProcessorBase.executePendingTasks(ProcessorBase.java:68)
>  ~[artemis-commons-2.31.0.jar:?]
>      at 
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
>  [?:?]
>      at 
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
>  [?:?]
>      at 
> org.apache.activemq.artemis.utils.ActiveMQThreadFactory$1.run(ActiveMQThreadFactory.java:118)
>  [artemis-commons-2.31.0.jar:?]
> 2023-12-19 16:09:45,109 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=81], 
> variableHeader=MqttConnectVariableHeader[name=MQTT, version=5, 
> hasUserName=true, hasPassword=true, isWillRetain=false, isWillFlag=false, 
> isCleanSession=false, keepAliveTimeSeconds=60], 
> payload=MqttConnectPayload[clientIdentifier=dc6b05c6-c09f-4d41-976b-70ae7017d1e3,
>  willTopic=null, willMessage=null, userName=artemis, password=[...]]]
> java.lang.IllegalStateException: AMQ850000: Unable to store MQTT state within 
> given timeout: 5000ms
>      at 
> org.apache.activemq.artemis.core.protocol.mqtt.MQTTStateManager.storeSessionState(MQTTStateManager.java:177)
>  ~[artemis-mqtt-protocol-2.31.0.jar:2.31.0]
>      at 
> org.apache.activemq.artemis.core.protocol.mqtt.MQTTStateManager.getSessionState(MQTTStateManager.java:130)
>  ~[artemis-mqtt-protocol-2.31.0.jar:2.31.0]
>      at 
> org.apache.activemq.artemis.core.protocol.mqtt.MQTTConnectionManager.getSessionState(MQTTConnectionManager.java:206)
>  ~[artemis-mqtt-protocol-2.31.0.jar:2.31.0]
>      at 
> org.apache.activemq.artemis.core.protocol.mqtt.MQTTConnectionManager.connect(MQTTConnectionManager.java:71)
>  ~[artemis-mqtt-protocol-2.31.0.jar:2.31.0]
>      at 
> org.apache.activemq.artemis.core.protocol.mqtt.MQTTProtocolHandler.handleConnect(MQTTProtocolHandler.java:267)
>  ~[artemis-mqtt-protocol-2.31.0.jar:2.31.0]
>      at 
> org.apache.activemq.artemis.core.protocol.mqtt.MQTTProtocolHandler.act(MQTTProtocolHandler.java:159)
>  ~[artemis-mqtt-protocol-2.31.0.jar:2.31.0]
>      at org.apache.activemq.artemis.utils.actors.Actor.doTask(Actor.java:32) 
> ~[artemis-commons-2.31.0.jar:?]
>      at 
> org.apache.activemq.artemis.utils.actors.ProcessorBase.executePendingTasks(ProcessorBase.java:68)
>  ~[artemis-commons-2.31.0.jar:?]
>      at 
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
>  [?:?]
>      at 
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
>  [?:?]
>      at 
> org.apache.activemq.artemis.utils.ActiveMQThreadFactory$1.run(ActiveMQThreadFactory.java:118)
>  [artemis-commons-2.31.0.jar:?]
> {noformat}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to