2 Replies Latest reply on Oct 1, 2018 7:25 AM by vignesh_3651841

    Receiving large MQTT packets (16000 bytes)

    vignesh_3651841

      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.

        • 1. Re: Receiving large MQTT packets (16000 bytes)
          riya

          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.

          1 of 1 people found this helpful
          • 2. Re: Receiving large MQTT packets (16000 bytes)
            vignesh_3651841

            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.