kmwebnet / ECC608-AzureDPS-Provision

Azure DPS auto provisioning test by ESP32 using ATECC608A IO Protection & MbedTLS
MIT License
2 stars 0 forks source link

Large message payload crashes #8

Open sfarras opened 3 years ago

sfarras commented 3 years ago

Great work!

Issue found: Sending a message larger than 16384Bytes ("TLS maximum message content length setting" in menuconfig) makes system crash.

Same problem when sending DirectMethods with a payload greater than the same value.

A solution (or comment) to fix it, will be greatly appreciated !! (Note Azure payload specs are about 256KB , and the examples found aroud (without ECC608) work great with big payloads.)

How to repoduce the issue: Change lines 289-290 in prov_dev_client_II_sample.c from : _static char msgText[1024]; sprintf_s(msgText, sizeof(msgText), "{ \"message_index\" : \"%zu\" }", msgcount++); to _static char msgText[20000]; sprintfs(msgText, sizeof(msgText), "{ \"message\" : \"%0*d \"}", 18000,0);

A solution (or comment) to fix it, will be greatly appreciated !! Have a good Olympics !!!

kmwebnet commented 3 years ago

Hello. I also have no experience dealing with large payloads in this project. After connecting to Azure DPS and provisioning to Azure IoT Hub, this project throws away the connection handle and connects to Azure IoT Hub again. I don't think it's efficient memory management.

In this project, I provisioned to Azure IoT Hub through Azure DPS, and the actual connection to Azure IoT Hub is ECC608-AzureIoT-Connect. I'm using the above project. This should have a plain MQTTS connection without the big Azure IoT SDK-C and less memory. We hope for your reference.