Repository navigation
fix(mqtt): advertise Maximum Packet Size in the embedded CONNECT - #284
Merged
Merged
Conversation
The embedded session receives packets of up to 3,328 bytes in every case (its 3,584-byte buffer minus one read), but its CONNECT never said so. A broker could send a larger packet, which ends the session; a retained one ends every session it is replayed into, so the client reconnected forever. CONNECT now carries MaximumPacketSize = 3,328, and a broker withholds anything larger. The fake test broker records the property and withholds oversized pushes as a compliant broker must. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
lxsaah
added a commit
that referenced
this pull request
Oct 6, 2026
Brings #284 (advertise Maximum Packet Size in the embedded CONNECT). The branch already sends the same CONNECT properties through `connect_packet`; the conflicts keep the branch's side. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Oct 6, 2026
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.
The embedded backend receives packets of up to 3,328 bytes in every case: its 3,584-byte reassembly buffer minus one 256-byte read. Its MQTT 5 CONNECT never told the broker that. A broker could therefore send a larger packet, which ends the session with
PacketTooLargeForBuffer. A retained message that large is replayed after every SUBSCRIBE, so the client reconnected forever, once per reconnection delay.The issue predates design 054 and is independent of it, so it goes to
maindirectly. It was found in the review of #283, which also added a proof of the reconnect loop on the feature branch.Change
session_loop.rs:MAX_INBOUND_PACKET = PACKET_BUFFER_SIZE − RX_CHUNK(3,328).MaximumPacketSize(3328)besideTopicAliasMaximum(0)(Connect<'_, 2, 0>).tests/common(the fake broker):Tests
the_advertised_maximum_packet_size_is_always_received(unit):a_retained_message_over_the_maximum_packet_size_is_withheld(tokio_broker, fake broker):Verification
session_loop6,tokio_broker4,embassy_broker1,tls_session3,tls_broker3,backend_parity8,--features std40,embedded-tlslib 30: all pass.aimdb-mqtt-connectorclippy leg from the Makefile (host, test targets,thumbv7em) andcargo fmt --all --check: clean.embassy-mqtt-connector-demobuilds forthumbv8m.main-none-eabihf.Note for the 054 feature branch
Merging
mainintofeat/054-connector-boundarywill conflict in the CONNECT block ofsession_loop.rs:queue(outbound, encode(&connect)?)here againstring.put(&connect, 0)there. Keep the ring call and the new property. After that merge,proof_a_4000_byte_retained_message_reconnects_foreverfrom #283 flips to this PR's behaviour.🤖 Generated with Claude Code