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
Client will disconnect with error "Unsolicited pubrel packet"
Failure Information (for bugs)
This issue is a little hard to reproduce, as we have to stop before sending PubComp
One method to reproduce/test:
clone rumqttc repo
ignore the incoming pubrel ( basically return early from this function )
fnhandle_incoming_pubrel(&mutself,pubrel:&PubRel) -> Result<(),StateError>{returnOk(());
__rest of the body__
}
use any example to publish some QoS2 message ( with clean session false! ).
stop / close the example.
restore the incoming pubrel function
fnhandle_incoming_pubrel(&mutself,pubrel:&PubRel) -> Result<(),StateError>{// return Ok(()); ( remove this line! )
__rest of the body__
}
re-run the example
Context
The PubRel packets which haven't received the PubComp yet, are treated as unacknowledged, and are resend on reconnection with clean session false and if session is present. ( reference )
When a client disconnects, we can't really store its state ( unless we use some disk persistence ). So there is no way if we can know whether to expect / not expect a PubRel packet when we reconnect.
Therefore, we should try to just reply with PubComp without worrying about whether we expect it or not. This should be fine as there is no standard for ordering of PubComp packets in OASIS standards.
I think I have just caught this issue in production (with mosquitto as broker). Our client keeps disconnecting after reconnect, effectively getting stuck in a reconnect loop 'forever' as the broker keeps sending the PUBREL.
Our client keeps disconnecting after reconnect, effectively getting stuck in a reconnect loop 'forever' as the broker keeps sending the PUBREL
if you are reconnecting by just polling eventloop again ( without terminating the program completely / dropping eventloop ), it should have pending pubrels in its pending
can you please provide minimal example if that is the case?
It appears that the paho client also had this same issue a few years ago
oh, thanks for pointing out, seems like they also didn't tackle this due to same reason 👀
Expected Behavior
We should reply with
PubComp
forPubRel
Current Behavior
Client will disconnect with error "Unsolicited pubrel packet"
Failure Information (for bugs)
This issue is a little hard to reproduce, as we have to stop before sending
PubComp
One method to reproduce/test:
Context
The
PubRel
packets which haven't received thePubComp
yet, are treated as unacknowledged, and are resend on reconnection with clean session false and if session is present. ( reference )When a client disconnects, we can't really store its state ( unless we use some disk persistence ). So there is no way if we can know whether to expect / not expect a
PubRel
packet when we reconnect.Therefore, we should try to just reply with
PubComp
without worrying about whether we expect it or not. This should be fine as there is no standard for ordering ofPubComp
packets in OASIS standards.Would love to discuss more on this, or if you have any other better solution!
The text was updated successfully, but these errors were encountered: