Skip to content

MQTT-SN subscriber doesn't receive any messages after a reconnection (clean session disabled and QOS=1 for messages) #733

Open
@marcoratto

Description

@marcoratto

Expected behavior

If a subscriber disconnected from a MQTT-SN Broker, it should receive all messages sent during the disconnection period once it reconnects.
According to the specification MQTT-SN_spec_v1.2.pdf, page 22:

6.3 Clean session
With MQTT, when a client disconnects, its subscriptions are not deleted. They are persistent and valid for new
connections, until either they are explicitly un-subscribed by the client, or the client establishes a new connection
with the “clean session” flag set.
In MQTT-SN the meaning of a “clean session” is extended to the Will feature, i.e. not only the subscriptions
are persistent, but also the Will topic and the Will message.

Actual behavior

MQTT-SN subscriber doesn't receive any messages.

To Reproduce

Step 0: Run HiveMQ Edge on a Docker Container

docker pull hivemq/hivemq-edge
docker run --name hivemq-edge -d -p 1883:1883 -p 8080:8080 -p 2442:2442/udp hivemq/hivemq-edge

Step 1: Subscribe to an MQTT topic

mosquitto_sub -h 127.0.0.1 -p 1883 -c -i mqtt-client-sub -t mqttsn/sample/normal -q 1

clean session disabled, QOS=1 and ClientID fixed

Step 2: Subscribe to an MQTT-SN normal topic

mqtt-sn-sub -h 127.0.0.1 -p 2442 -c -q 1 -i mqttsn-client-sub -t mqttsn/sample/normal

clean session disabled, QOS=1 and ClientID fixed

Step 3: send a message on MQTT topic

mosquitto_pub -h 127.0.0.1 -p 1883 -t mqttsn/sample/normal -m "hello 1" -q 1

Step 4: send a message on MQTT topic

mosquitto_pub -h 127.0.0.1 -p 1883 -t mqttsn/sample/normal -m "hello 2" -q 1

Step 5: Stop MQTT subscriber

Stop mosquitto_sub

Step 6: Stop MQTT-SN Subscriber

Stop mqtt-sn-sub

Step 7: send a message on MQTT topic

mosquitto_pub -h 127.0.0.1 -p 1883 -t mqttsn/sample/normal -m "hello 3" -q 1

Step 8: send a message on MQTT topic

mosquitto_pub -h 127.0.0.1 -p 1883 -t mqttsn/sample/normal -m "hello 4" -q 1

Step 9: Subscribe again to an MQTT topic

mosquitto_sub -h 127.0.0.1 -p 1883 -c -i mqtt-client-sub -t mqttsn/sample/normal -q 1

Receive correctly messages "hello 3" and "hello 4"

Step 10: Subscribe again to an MQTT-SN normal topic (ERROR)

mqtt-sn-sub -h 127.0.0.1 -p 2442 -c -q 1 -i mqttsn-client-sub -t mqttsn/sample/normal

It doesn't receive any messages.
No error log on container image.

Reproducer code

n/a

Details

  • Affected HiveMQ Edge version(s): 2024.9
  • Used JVM version: Internal of the container

Metadata

Metadata

Assignees

No one assigned

    Labels

    trackedTracked by an external ticketing system

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions