hivemq / hivemq-mqtt-client

HiveMQ MQTT Client is an MQTT 5.0 and MQTT 3.1.1 compatible and feature-rich high-performance Java client library with different API flavours and backpressure support
https://hivemq.github.io/hivemq-mqtt-client/
Apache License 2.0
832 stars 153 forks source link

MQTT client receives same message multiple times when its session terminated by network or system error or broker sending Disconnect to client. #581

Open vshirol opened 1 year ago

vshirol commented 1 year ago
          [threadump_before_conn_reset.zip](https://github.com/hivemq/hivemq-mqtt-client/files/11913281/threadump_before_conn_reset.zip)

threadump_after_2times_conn_reset.zip Hi @pglombardo The above-mentioned issue is solved with your proposed code change. Thanks. But we do see similar problem in different scenario, that is when MQTT broker terminates client connection by sending Disconnect MQTT packet to client or when connection reset occurs on client side, in this case MQTT broker is still running and not restarted.

So, in these scenarios with above mentioned code change doesn't help, client receives the duplicate message which is equal to number of times its connection reset either by broker or system error or client-side network issues. Let me know if you need any more details from my side.

From thread dump we do see, upon every connection reset there is an increase in RxComputationThreadPool instance. Attaching thread dump of both normal and after 2 times connection

Thanks, Vasant

Originally posted by @vshirol in https://github.com/hivemq/hivemq-mqtt-client/issues/552#issuecomment-1614156291