Conversation
clean() rebuilt pending from outgoing_pub/outgoing_rel and reset collision_ping_count, but never took self.collision. When the session is lost across a reconnect (clean_session = true, or session_present = false dropping pending), the colliding pkid is never re-acked, so the stashed publish is silently lost and the request branch stays disabled: the client loops CollisionTimeout -> reconnect -> clean() forever, sending nothing but pings and CONNECTs. Push the stashed publish into pending during clean() (v4 and v5); its outgoing_pub slot is free after the sweep and it already carries a pkid. Adds regression tests for both protocol versions. Fixes bytebeamio#1056 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1056.
Problem
MqttState::clean()rebuildspendingfromoutgoing_pub/outgoing_reland resetscollision_ping_count, but never takesself.collision. When the session is lost across a reconnect (clean_session = true, orsession_present = falsedroppingpending), the colliding pkid is never re-acked, so:!collisiongate ineventloop.rs), so the client loopsCollisionTimeout→ reconnect →clean()forever, sending nothing but pings and CONNECTs.Full analysis in #1056.
Fix
Push the stashed publish into
pendingduringclean()— itsoutgoing_pubslot is free after the sweep and it already carries a pkid, so it rides the normal retransmission path. Applied to both v4 and v5 state, with a regression test each (clean_recovers_collision_stashed_publish).On a resumed session the old self-heal path (
check_collisionon the ack of the colliding pkid) still works; this change only matters when that ack can never arrive.Tests:
cargo test -p rumqttc --lib --no-default-features— 75 passed.🤖 Generated with Claude Code