Closed vaavva closed 3 months ago
Thanks for reporting the issue. Yes, puback, unsuback / other acks shouldn't disconnect the client. Only some of the state errors should lead to disconnect.
Would love to see PR to fix this behaviour!
Proposed a fix in https://github.com/bytebeamio/rumqtt/pull/877, please check.
PR #877 is merged, can you please verify if it resolves the issue @vaavva ? thanks :)
Yes, this fixed my issue, thank you!
Expected Behavior
UnsubFail/PubAckFail/etc should not act as a disconnect as they are packet specific and fully recoverable.
Current Behavior
In the event loop, anything that is an Err, not Ok calls self.clean() https://github.com/bytebeamio/rumqtt/blob/main/rumqttc/src/v5/eventloop.rs#L168, which should only be called when the client is disconnected (https://github.com/bytebeamio/rumqtt/blob/main/rumqttc/src/v5/eventloop.rs#L120)
However, ConnectionError includes MqttState errors (https://github.com/bytebeamio/rumqtt/blob/main/rumqttc/src/v5/eventloop.rs#L38), which includes things like EmptySubscription, OutgoingPacketTooLarge, UnsubFail, PubAckFail, etc https://github.com/bytebeamio/rumqtt/blob/main/rumqttc/src/v5/state.rs#L38 . So any of these errors will act as a disconnect it seems.
Failure Information (for bugs)
Please help provide information about the failure if this is a bug. If it is not a bug, please remove the rest of this template.
Context
Please provide any relevant information about your setup. This is important in case the issue is not reproducible except for under certain conditions.
Failure Logs
On duplicate unsubs (second should return a failure rc with NoSubscriptionExisted), which is shown from the event loop, but a reconnect also occurs
mosquitto broker logs:
For a pub on an unauthorized topic
mosquitto broker logs: