-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
mqtt not properly acknowledging messages? #1773
Comments
m:connect("[broker redacted]",1883,0,0)
m:subscribe("ctfws/game/message",2) Not the root cause here but I'm surprised this even works considering that you should |
Almost surely not the relevant cause; I'll fix the minimized example to respect that constraint, tho'. |
OK, this is going to be a long comment. I have asked for, and gotten, a
I have revised the minimum (non-)working example thusly. Having set all of
when I see that DHCP has succeeded, I run
On a nearby host, I send some traffic, including an empty message, thus:
For all QOS=0, this seems to work fine, and no nil message appears out of sequence; messages come in and debugging spews from the machine:
However, if I set all the QOS to 1 and re-run the experiment, something is immediately fishy:
Zooming in a bit, I see
The message IDs are perfectly incremented up through and including message "5", then mysteriously 0 rather than 6 for the empty message, then 7 and on again for the non-empty messages. That looks like a parser bug on the nodemcu side. In fact, 0 looks like an error value from In fact, looking at Anyway, back to the test... running this with QOS=2 really confuses things; we don't even always make it to the empty message before falling offline:
I am not sure what to make of that. |
It occurs to me, belatedly, to tag @pjsg for his opinion on the above. |
Now that #1906 is merged do you want to keep this open? |
Yes; I believe #1906 is only a partial fix to the issues enumerated above. In particular, I do not believe it has bearing on the QoS=2 case above. |
Partially addresses nodemcu#1773.
Please take this for a new test now with #2571 merged to dev, I did some quick tests and it seems at least I don't get a screaming warnings in mosquitto, but I don't think its 100% perfect, seeing some repeated messages for some reason, when there is no sleep between the sends (i.e between the empty msg and the first on in second loop):
Don't have time to dig further myself though! |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Something appears to go wrong, occasionally, especially with empty messages. I've tested this against both a mosquitto and a vernemq broker, so I think it really is an issue with nodemcu's mqtt implementation.
I am running the following code on the device
The device itself identifies as
On another machine, I am using
mosquitto_pub
to lob messages at the broker. If I runthen I get the expected single shot delivery:
with the message never repeated. But if I then run
then I get the message sent several times, 20 seconds apart:
20 seconds is the default for mosquitto's "retry_interval" value, so this looks very much like broker-initiated retransmission, and indeed the broker screams bloody murder:
repeated over and over. Curiously this seems to happen most often with empty messages, but I have seen it with others, too.
If I downgrade the QoS on transmission from 2 to 1, and send
I will not get the
PUBREC
warning above in the broker's logs, but I will be rewarded with an empty message being re-delivered out of order after the retry timeout:I have seen this happen on other builds, too, including on master rather than dev.
If there's anything more I can add, please don't hesitate to ask.
Thanks much!
--nwf;
The text was updated successfully, but these errors were encountered: