Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mosquitto doesn't publish Last Will when LWT Delay interval is specified (MQTT v5.0) #2912

Open
HamzaHajeir opened this issue Sep 30, 2023 · 0 comments

Comments

@HamzaHajeir
Copy link

Hi there,

I've noticed that Mosquitto doesn't publish Last Will & Testament when I set LWT Delay Interval.

  • OS: Windows 11
  • Version: 2.0.15
  • MQTT Version: 5

Wireshark ensures setting the LWT within CONNECT packet, and here's a hexdump:

0x00000000     0:  10 8F 01 00 04 4D 51 54 54 05 36 00 12 39 11 00   .....MQTT.6..9..
0x00000010    16:  00 0E 10 21 00 19 27 00 00 14 50 22 00 32 17 01   ...!..'...P".2..
0x00000020    32:  19 01 26 00 0A 55 73 65 72 2D 41 67 65 6E 74 00   ..&..User-Agent.
0x00000030    48:  16 48 34 41 73 79 6E 63 4D 51 54 54 20 76 31 2E   .H4AsyncMQTT v1.
0x00000040    64:  30 2E 30 2D 72 63 36 00 18 53 53 54 2D 53 6D 61   0.0-rc6..SST-Sma
0x00000050    80:  72 74 53 6F 63 6B 65 74 33 41 2D 30 30 30 30 32   rtSocket3A-00002
0x00000060    96:  30 07 01 01 18 00 00 00 19 00 1E 53 53 54 2D 53   0..........SST-S
0x00000070   112:  6D 61 72 74 53 6F 63 6B 65 74 33 41 2D 30 30 30   martSocket3A-000
0x00000080   128:  30 32 30 2F 73 74 61 74 65 00 07 6F 66 66 6C 69   020/state..offli
0x00000090   144:  6E 65                                             ne

Image from Wireshark to dump the CONNECT Packet:
image

* There's a LWT Delay interval of 25 seconds
* Retain is enabled for the LW, QoS2.
* keepalive: 18 seconds

Mosquitto configuration file:

per_listener_settings true

listener 1883
allow_anonymous true

listener 8883 0.0.0.0
allow_anonymous true

# Path to the PEM encoded server certificate.
certfile C:\Program Files\mosquitto-2-0-15\certs\mqtt.crt

# Path to the PEM encoded keyfile.
keyfile C:\Program Files\mosquitto-2-0-15\certs\mqtt.key

The client sends "online" to "SST-SmartSocketA3-000020/state" (Retain, QoS2) topic when connected.
Never received the "offline" LWT.

Eliminated the LW Delay Interval, and the LWT is published immediately.

1696107762: Client SST-SmartSocket3A-000020 has exceeded timeout, disconnecting.
1696107762: Sending PUBLISH to mqtt-explorer-4a8cd6fd (d0, q0, r0, m0, 'SST-SmartSocket3A-000020/state', ... (7 bytes))
1696107762: Sending PUBLISH to mqttx_4e47ea97 (d0, q2, r0, m7, 'SST-SmartSocket3A-000020/state', ... (7 bytes))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant