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
{{ message }}
Repository navigation
mqtt: pending acknowledgements are tracked per stream sequence, not per connection packet id #3166
In MqttServerFactory the pending-acknowledgement bookkeeping is held per connection but keyed by a per-topic stream sequence (line numbers on develop at b1a53e9, approximate: ~2652, ~6355-6359, ~6518-6560). Streams for different topics each have their own sequence numbers, so entries from different topics can collide in the connection-level map. The acknowledgement loop also removes entries while iterating over them.
This is suspected from reading the code and has not been run. The first step is a test that either shows a wrong acknowledgement (an ack for one topic completing or removing another topic's pending message) or shows that the collision cannot happen.
MQTT 5.0 section 4.4 and MQTT 3.1.1 section 4.4: packet ids identify in-flight messages for the whole session regardless of topic.
Expected
If the collision is demonstrated: pending acknowledgements are keyed so that messages for different topics on one connection cannot affect one another, and removal during acknowledgement does not skip or double-process entries.
If it cannot be demonstrated: stop, record the analysis on this issue, and close it as not planned; do not change the code.
Test plan (test-first)
Spec scripts for v5 and v4 with two subscriptions on different topics whose streams carry overlapping sequence values, with out-of-order and interleaved acknowledgements. The first commit contains the scripts that demonstrate the defect; if none can, report that instead.
Notes
Found by a clause-by-clause audit of MQTT 3.1.1 and 5.0 conformance, by reading the code. Related to the packet id work under the shared subscriptions stack, which this issue does not depend on. Part of the MQTT conformance work under #512.
Activity