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
Will Delay Interval is not working as expected #1298
Comments
@wlisac thanks! |
Hi @wlisac, I looked into this, and as we had a test case covering this exactly I tried to vary a bit the settings (clean_start=true/false), the will delay etc, but I wasn't able to verify the issue. I would have like to try to test this with a cli client, but the paho c clients doesnt' seem to support setting the will delay. Which client do you use to verify this? For reference the testcase in our test suite: https://github.com/vernemq/vernemq/blob/master/apps/vmq_server/test/vmq_last_will_SUITE.erl#L158 |
@larshesel I'm testing with my work-in-progress client, but I was also able to reproduce using MQTT JS. Check out // Start VerneMQ broker
// Listen for will message on a different client
// $ mosquitto_sub -h localhost -p 1883 -t 'will-topic' -d
// Run this file using node
// $ node test.js
// Notice the delay is not honored using VerneMQ. It is honored using the Mosquitto broker.
const mqtt = require('mqtt');
const options = {
will: {
topic: 'will-topic',
payload: 'hello',
properties: {
willDelayInterval: 10
}
},
protocolVersion: 5,
clientId: 'mqttjs_' + Math.random().toString(16).substr(2, 8),
properties: {
sessionExpiryInterval: 60
}
}
const client = mqtt.connect('mqtt:https://localhost:1883', options);
client.on('connect', function () {
throw 'Goodbye!'
}) |
@larshesel here's possibly a simpler way to reproduce using
And terminate the connection with |
Hi @wlisac I can indeed reproduce it with the Bonus for me here is that I now finally updated my mosquitto clients to the |
Awesome – another edge case to watch out for when fixing this is handling when the Will Delay Interval is longer than Session Expiry Interval. I recently opened an issue on the mosquitto broker for this: eclipse/mosquitto#1401 Some helpful notes from the 5.0 spec:
|
Hi @wlisac I think I figured out what is going on, and it's a bit embarrassing that I
Remembering back we introduced this configuration to have a way to |
Btw @wlisac We really appreciate your feedback here and would like to acknowledge your efforts (albeit in a very minimal way) by adding you to the THANKS file: https://github.com/vernemq/vernemq/blob/master/THANKS I'd then add you as |
I created a PR #1310 which introduces a new value to |
I think we can close this for now :) |
@larshesel I tested the changes in your branch and the delay is now working as expected. Thanks! And I'd be honored to be mentioned in the As far as the The broker doesn't have a way to communicate to the client that the will delay interval isn't what the client sent, but it does have a way to communicate the session expiry interval is different than requested (via CONNACK in 5.0 spec). And since the Will Delay Interval is effectively capped to the session expiry interval, I think you accomplish the same goal :)
|
I'm not sure that's needed as this always holds as you mention and one could achieve this by simply setting the |
Added a commit to THANKS file in the #1310 PR : https://github.com/vernemq/vernemq/pull/1310/files#diff-df89e795839ea42c0425275caa0e08fcR25 |
@larshesel It's possible that I'm misunderstanding, but it seems like there is still a config point ( It seems like this config point shouldn't allowed since there isn't a way to communicate this actual will delay interval back to the client. And if the will delay interval is ever forced to be lower than the session expiry max, then that would seem to violate the spec. I'm not sure I'm communicating my point well here 😅 – to flip it around – what is the use case for the |
You're right that this violates the spec if used. The idea is (like many other features, like |
Environment
DOCKER_VERNEMQ_LISTENER__TCP__ALLOWED_PROTOCOL_VERSIONS=3,4,5
Expected behavior
I'm expecting the Will Delay Interval to delay the publishing of the Will Message after closing the network connection.
Actual behaviour
Connect to VerneMQ broker using version 5.0 of the MQTT protocol with a
Session Expiry Interval
of60
and aWill Delay Interval
of10
.Receive a
CONNACK
from VerneMQClose the network connection without sending a Disconnect Notification
Notice that the Will Message is published immediately (I expected a 10 second delay)
Additional Notes
I'm detecting the Will Message being published using a different client that's subscribed to the
will-topic
topic.I tested this flow using the mosquito broker and it's working as expected (the Will Delay Interval is being honored).
I'm working on writing an MQTT client and I'm hoping to understand if this might be a bug in VerneMQ.
Here are some relevant notes from the MQTT 5.0 protocol spec:
I'm happy to provide more details as needed.
Thanks,
Will
The text was updated successfully, but these errors were encountered: