Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Mosquitto » QoS2 Publishes reordered(I've seen an out-of order-publish (QoS 2) forwarded by the broker.)
QoS2 Publishes reordered [message #1831190] Thu, 13 August 2020 09:18 Go to next message
Andrew Walsh is currently offline Andrew WalshFriend
Messages: 5
Registered: November 2019
Junior Member
Hello,

I've been developing an embedded device which has an MQTT connection; I am using Mosquitto to test this, along with mosquitto_pub.

I have written a Bash script to split up a file into 256 byte chunks and publish them on a topic subscribed to by my embedded device. When my device receives the entire file, I find that it is different from the original source file; I'm able to find the first place that it differs and use this to determine which block seems to be incorrect. I then look for this block in a Wireshark capture, and I find a block with a message ID here, which appears to be out-of-order (I assume that Mosquitto will just increment a count when generating a message ID for a publish? I restarted Mosquitto prior to running this test, so that the message IDs would start at 1).

Specifically, I have publishes with message IDs from 1 to 220 (not checked them all, but I think they are all in order), and then I get a publish with a message ID of 542, which is then followed by a publish with a message ID of 221 (and subsequent publishes which, again, *appear* to be in order, without checking them thoroughly).

My embedded device is subscribing to the topic with QoS2, and my script tells mosquitto_pub to publish with QoS2, so I would expect that Mosquitto would forward the blocks in the same order that it has received them.
My device is also connecting with clean session = 0, but I've not configured the broker to keep the session in non-volatile storage.

I did wonder if the Bash script was publishing the blocks out-of-order, but if that was the case, I would not expect to see out-of-order message IDs, just out-of-order data.

I'm using Mosquitto 1.6.11, under Ubuntu 18.04 and I'm using TLS-PSK for security (although I don't expect that to cause this!). The broker IP address is 192.168.1.1, I'm running mosquitto_pub on the same machine and the embedded device (having IP 192.168.1.2) is connected to the Ethernet port on the same machine.
Am I missing something in my configuration, perhaps? If it's any use, I can provide a log file and a Wireshark capture.

Thanks.

[Updated on: Thu, 13 August 2020 09:26]

Report message to a moderator

Re: QoS2 Publishes reordered [message #1831213 is a reply to message #1831190] Thu, 13 August 2020 20:18 Go to previous messageGo to next message
Roger Light is currently offline Roger LightFriend
Messages: 45
Registered: September 2013
Member
Hi Andrew,

What you're seeing definitely shouldn't happen. I've tried to reproduce this and failed so far. I used a Raspberry Pi 3 as the subscribing device and sent 1000 chunks of 256 byte data. Would you mind sharing the wireshark capture? You can send it to roger@atchoo.org if you don't want to share it publicly.

Cheers,

Roger
Re: QoS2 Publishes reordered [message #1831226 is a reply to message #1831213] Fri, 14 August 2020 07:55 Go to previous messageGo to next message
Andrew Walsh is currently offline Andrew WalshFriend
Messages: 5
Registered: November 2019
Junior Member
Hi Roger,

Thanks for your response!

Yes, I will email you the Wireshark capture and the Mosquitto log.

Best regards,

Andrew.
Re: QoS2 Publishes reordered [message #1831712 is a reply to message #1831190] Thu, 27 August 2020 08:31 Go to previous message
Andrew Walsh is currently offline Andrew WalshFriend
Messages: 5
Registered: November 2019
Junior Member
Hi Roger,

Just a quick heads up (presumably you've not had time to consider this yet).

I've greatly improved the reliability of the MQTT connection made by my embedded device firmware (no doubt, if you examined the Wireshark capture, you'll see that there are many reconnections, etc - caused by a problem in the processor manufacturer-supplied SDK, as it turns out) and I've not seen the problem with re-ordering since (admittedly I've not made many tests).

It still seems to me, however, that the message reordering shouldn't happen, even with a dodgy connection, but maybe this will aid in recreation, when you do have time to look at it.

Best regards,

Andrew.
Previous Topic:Building Mosquitto from Source on win32 - Errors in makefile from source?
Next Topic:Project not reconnecting
Goto Forum:
  


Current Time: Tue Oct 20 11:56:21 GMT 2020

Powered by FUDForum. Page generated in 0.01412 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top