Receiving large MQTT packets (16000 bytes)

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
ViRa_3651841
Level 1
Level 1
First like given

I am trying to reliably receive large MQTT packets using AWS IOT. With WICED 5.x, any packet of size greater than about 1375 bytes would create a fault, and my device would reboot. I moved to WICED 6.2 now and noticed support in the sample code for larger packets. Now I am trying to transfer around 16000 bytes, but am unable to do so with the high degree of confidence needed for production. 

I am able to receive all 16000 bytes correctly sometimes. When I am not able to, it appears that there is a timeout with the heartbeat.

From my debugging, it appears that the first 8 or 10 packets (out of a total of 12 packets for 16,000 bytes) are added to the queue which mqtt_thread_main waits on (in mqtt_network.c) and are processed successfully. Then, there is a delay (?) before the final packets are added to the queue and processed. This delay seems to be arbitrary and I believe is caused by the networking worker thread. I have experimented with increasing queue sizes for the networking thread but still the same issue persists.

Sometimes, this delay is so long that the heartbeat/keep_alive times out, and my device disconnects from the MQTT broker. Other times, when the transfer is successful, the remaining packets are received after the delay - and the receiving of these packets seems to coincide with the triggering of the timed event created in the mqtt_manager_heartbeat_init function.

Has anyone else experienced a similar issue? Would love to hear about others' experiences and/or suggestions on next steps or possible points of debug. My next step would be to try WICED 6.1 to see if maybe some of the optimizations/changes made in the recent release are to blame.

0 Likes
8 Replies
PriyaM_16
Moderator
Moderator
Moderator
250 replies posted 100 replies posted 50 replies posted

Hello Sir,

I have tested the publisher snip with a message size of 16000 bytes in WICED 6.2.1 and it appears to work fine. All the messages are being received at the AWS server.

[Application/AWS] Opening connection...

[AWS] AWS endpoint: axxxxxxxxxxxx.iot.ap-southeast-1.amazonaws.com is at xx.xx.xx.xx

[AWS/MQTT] Event received 1

[Application/AWS] Publishing...------------------ String length of msg: 9

Success

[AWS/MQTT] Event received 3

[Application/AWS] Publishing...------------------ String length of msg: 16132

Success

[AWS/MQTT] Event received 3

[Application/AWS] Publishing...------------------ String length of msg: 9

Success

[AWS/MQTT] Event received 3

[Application/AWS] Publishing...------------------ String length of msg: 16132

Success

[AWS/MQTT] Event received 3

Can you capture a few traces where the transfer fails? Kindly make changes to capture the returned error code.

Thanks for taking the time to test this riya​. However as I mentioned, the issue was not with the device publishing large packets but with the device receiving large packets. i.e. when my device is subscribed to a topic, and I use AWS IOT to post a 16000-byte message to that topic, I don't see a high level of reliability - often, the MQTT heartbeat times out. Please test this as well if you can - I can provide error logs if you're able to successfully receive large messages as well.

0 Likes

Which network stack are you using? NextX, NetXDuo or LwIP?

0 Likes

I was able to receive data only up to 3000 bytes. It times out after 3k data and closes the connection.

0 Likes

riya wrote:

I was able to receive data only up to 3000 bytes. It times out after 3k data and closes the connection.

Then you just confirmed the issue, right?

0 Likes

Yes. We have created an internal ticket for the same.

0 Likes

Hi, what is the status of this issue? I have just tested it on WICED 6.4.0 and the issue is still present.

0 Likes

ViRa_3651841

You may want to create a new discussion and reference this thread from it as I'm not sure anyone on the team is policing these older threads.

0 Likes