You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The current client implementation will send the PUBACK (likely the same for PUBREC/COMP) before calling the application callback. This can result in messages being lost if the application crashes during the callback.
According to the V3/V5 specs Section 4.3, I believe the intent of the protocol is for the ACK/COMP messages to indicate that the application takes ownership of the message, and not the protocol library.
I propose moving the message acknowledgment after the callback for QoS 1 and 2.
Details
Currently, send__puback is called before the on_message callback:
If the ordering is reversed (on_message before send__puback), even if the application crashes in the callback the message isn't lost and will be sent again by the broker after the application recovers (reconnects).
Version: Mosquitto Client (master branch pulled around tag 2.0.16, built from sources).
The current client implementation will send the PUBACK (likely the same for PUBREC/COMP) before calling the application callback. This can result in messages being lost if the application crashes during the callback.
According to the V3/V5 specs Section 4.3, I believe the intent of the protocol is for the ACK/COMP messages to indicate that the application takes ownership of the message, and not the protocol library.
I propose moving the message acknowledgment after the callback for QoS 1 and 2.
Details
Currently,
send__puback
is called before theon_message
callback:mosquitto/lib/handle_publish.c
Line 142 in 1ed275b
mosquitto/lib/handle_publish.c
Line 146 in 1ed275b
If the ordering is reversed (
on_message
beforesend__puback
), even if the application crashes in the callback the message isn't lost and will be sent again by the broker after the application recovers (reconnects).Version: Mosquitto Client (master branch pulled around tag 2.0.16, built from sources).
Related: #118
The text was updated successfully, but these errors were encountered: