eclipse / paho.golang

Go libraries
Other
330 stars 92 forks source link

paho - dealing with corrupt messages in the store #195

Closed MattBrittan closed 10 months ago

MattBrittan commented 10 months ago

Describe the bug

When retransmitting packets from the session state (paho/session/state/state.go ConAckReceived function) the potential for corrupt messages is not handled. For example if there is an empty file (something I have seen in production on a test deployment to a machine that is stopped randomly) then the attempt will be aborted, MQTT will reconnect and the same file will be read.

We need to implement something similar to what I've done in autopaho/queue and remove any corrupt messages (this may include adding some sanity checking rather than just sending a potentially corrupt message to the server).

To reproduce

Create a zero byte packet in the sotre and connect.

Debug output

Same error repeated over and over.

Expected behaviour

Move the file to an error state (or for memory queue probably just delete it).

Software used:

@master