rotonda icon indicating copy to clipboard operation
rotonda copied to clipboard

Improve error when non-unique MQTT client ID causes broker disconnection

Open ximon18 opened this issue 2 years ago • 3 comments

Currently this results in the following unhelpful log message: (line wrapped for readability)

[2023-11-20 23:28:10] WARN  rotonda::targets::mqtt::status_reporter: mqtt: MQTT connection error: 
Mqtt state: Io error: Custom { kind: ConnectionAborted, error: "connection closed by peer" }

ximon18 avatar Oct 30 '23 13:10 ximon18

At least in the case of broker.emqx.io it seems there's nothing we can do about this as the underlying rumqttc client code doesn't receive anything either, it just discovers that its connection has been closed hence the error message it produces. Also, when reconnecting we cause another connected client to disconnect, the rumqttc client code doesn't receive an error about duplicate client ID.

ximon18 avatar Nov 20 '23 22:11 ximon18

The same behaviour was also observed with broker.hivemq.com, test.mosquitto.or, publicmqtt.bevywise.com and a locally running EMQX Docker MQTT broker.

ximon18 avatar Nov 20 '23 23:11 ximon18

I wonder if this is an MQTTv3 protocol thing and with v5 it would be different?

ximon18 avatar Nov 22 '23 09:11 ximon18