6 Replies Latest reply on Dec 3, 2018 2:51 AM by riya

    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.