fusesource / mqtt-client

A Java MQTT Client
http://mqtt-client.fusesource.org/
Apache License 2.0
1.27k stars 369 forks source link

Duplicated messageId #123

Open lacourte opened 4 years ago

lacourte commented 4 years ago

This problem has been raised in the context of a test program, publishing a very large number of QoS 1 messages. It triggers the following message: java.net.ProtocolException: Command from server contained an invalid message id:

When a QoS 1 PUBLISH message is sent, an entry is created in the requests table of CallbackConnection. The entry is removed when the matching PUBACK message is processed. If for any reason the broker is slowed down, the messageId counter of the client may loop, and a second message with the same messageId may be sent while the first message is still in the requests table. The corresponding entry in the table is then overridden and the client is then corrupted.