Repository navigation
fix(eon): preserve the Last Will on graceful shutdown - #66
Merged
Merged
Conversation
Publish the NDEATH, stop accepting data publishes, and let clients that support it disconnect without an MQTT DISCONNECT packet so the broker publishes the Last Will. This stops DATA messages arriving after NDEATH (which the TCK monitor reports as a sequence error) and addresses the MQTT 5 intentional disconnect requirement as far as rumqttc allows. rumqttc 0.24 cannot set the 'Disconnect with Will Message' reason code, so the connection is closed instead of sending a normal DISCONNECT. - Add Client::disconnect_with_will with a default of false. - Implement it for the rumqttc client. - Stop data publishes before publishing the NDEATH in NodeHandle::cancel. - Add regression tests for the trait and shutdown behaviour.
dpazj
force-pushed
the
fix/session-termination
branch
from
November 3, 2026 20:21
547b358 to
359d2c3
Compare
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.
Summary
Fixes the Edge Node session termination path so it no longer sends DATA after NDEATH and no longer sends a normal MQTT 5
DISCONNECTwhen the client can let the broker publish the Last Will.Client::disconnect_with_will(). The default returnsfalse, so existing client implementations keep the current behaviour.srad-client-rumqtt: it returnstruewithout sending aDISCONNECTpacket, so dropping the event loop closes the connection and the broker publishes the will.NodeHandle::cancel, stop accepting data publishes, publish the NDEATH explicitly, and skipclient.disconnect()when the client handled the will path.Why
edge:SessionTerminationTestfailed with:because rumqttc always sends
NormalDisconnection(0.24, 0.25 and master hardcode it), and srad used a normal disconnect. The test also exposed a race: with the connection kept open briefly during shutdown, the data loop published NDATA after NDEATH, which the TCK monitor reports as an out-of-order sequence number.Result
The MQTT 5 disconnect-reason assertion is now
NOT EXECUTEDrather thanFAIL.cargo fmt --all --check,cargo clippy --all-targets -- -D warningsandcargo testpass.Trade-offs
Disconnect with Will Message(0x04), so this closes the connection without a DISCONNECT. The assertion stays unexecuted until rumqttc exposes reason codes; there is a TODO in the rumqtt client.