ARMmbed / mbed-client-for-aws

AWS IoT SDK port for Mbed OS
Apache License 2.0
8 stars 13 forks source link

Increasing size of shadow causes non-descript lwip errors #23

Open Spinnaker-design opened 1 year ago

Spinnaker-design commented 1 year ago

Description of defect

The shadow example works, but if the size of the desired shadow in increased, for example to be the following:

"desired": {
"DemoNumber": 200,
"DemoNumber1": 200,
"DemoNumber2": 200,
"DemoNumber3": 200,
"DemoNumber4": 200,
"DemoNumber5": 200,
"DemoNumber6": 200,
"DemoNumber7": 200,
"DemoNumber8": 200,
"DemoNumber9": 200,
"DemoNumber10": 200,
"DemoNumber11": 200,
"DemoNumber12": 200,
"DemoNumber13": 200,
"DemoNumber15": 200,
"DemoNumber16": 200,
"DemoNumber17": 200,
"DemoNumber18": 200,
"DemoNumber19": 200,
"DemoNumber20": 200,
"DemoNumber21": 200,
"DemoNumber22": 200,
"DemoNumber23": 200,
"DemoNumber24": 200
},

Then the demo will crash with a transportation error.

�[2K�[39m[INFO][Main]: Connecting to the network...�[0m

�[2K�[39m[INFO][Main]: MAC: 82:40:d9:48:7f:c4�[0m

�[2K�[39m[INFO][Main]: Connection Success�[0m

�[2K�[39m[INFO][TLSW]: Closing TLS�[0m

�[2K�[39m[INFO][TLSW]: Starting TLS handshake with a2fgq3ae82p7vl-ats.iot.us-east-2.amazonaws.com�[0m

�[2K�[39m[INFO][TLSW]: TLS connection to a2fgq3ae82p7vl-ats.iot.us-east-2.amazonaws.com established�[0m

�[2K�[39m[INFO][TLSW]: Certificate verification passed�[0m

�[2K�[39m[INFO][AWS SDK]: Packet received. ReceivedBytes=2.�[0m

�[2K�[39m[INFO][AWS SDK]: CONNACK session present bit not set.�[0m

�[2K�[39m[INFO][AWS SDK]: Connection accepted.�[0m

�[2K�[39m[INFO][AWS SDK]: Received MQTT CONNACK successfully from broker.�[0m

�[2K�[39m[INFO][AWS SDK]: MQTT connection established with the broker.�[0m

�[2K�[39m[INFO][Main]: Downloading Shadow Document�[0m

�[2K�[39m[INFO][AWS SDK]: Packet received. ReceivedBytes=3.�[0m

�[2K�[39m[INFO][AWS SDK]: Packet received. ReceivedBytes=3.�[0m

�[2K�[31m[ERR ][TLSW]: mbedtls_ssl_read() failed: -0x7200 (-29184): SSL - An invalid SSL record was received�[0m

�[2K�[31m[ERR ][AWS SDK]: A single byte was not read from the transport: transportStatus=-3012.�[0m

�[2K�[31m[ERR ][AWS SDK]: Receiving incoming packet length failed. Status=MQTTRecvFailed�[0m

�[2K�[31m[ERR ][AWS SDK]: A single byte was not read from the transport: transportStatus=-3012.�[0m

�[2K�[31m[ERR ][AWS SDK]: Exiting process loop due to failure: ErrorStatus=MQTTRecvFailed�[0m

�[2K�[31m[ERR ][AWS SDK]: Receiving incoming packet length failed. Status=MQTTRecvFailed�[0m

�[2K�[31m[ERR ][AWSClient]: MQTT_ProcessLoop error: 4�[0m

�[2K�[31m[ERR ][AWS SDK]: Exiting process loop due to failure: ErrorStatus=MQTTRecvFailed�[0m

�[2K�[31m[ERR ][TLSW]: mbedtls_ssl_read() failed: -0x7200 (-29184): SSL - An invalid SSL record was received�[0m

�[2K�[31m[ERR ][AWSClient]: MQTT ProcessLoop error: 4�[0m

�[2K�[31m[ERR ][AWS SDK]: A single byte was not read from the transport: transportStatus=-3012.�[0m

�[2K�[31m[ERR ][Main]: AWSClient::processResponses() failed�[0m

�[2K�[31m[ERR ][AWS SDK]: Receiving incoming packet length failed. Status=MQTTRecvFailed�[0m

�[2K�[31m[ERR ][AWS SDK]: Receiving incoming packet length fail84): SSL - An invalid SSL record was received�[0m

�[2K�[31m[ERR ][AWS SDK]: Exiting process loop due to failure: ErrorStatus=MQTTRecvFailed�[0m

�[2K�[31m[ERR ][AWS SDK]: A single byte was not read from the transport: transportStatus=-3012.�[0m

�[2K�[31m[ERR ][AWSClient]: MQTT ProcessLoop error: 4�[0m

�[2K�[31m[ERR ][AWS SDK]: Receiving incoming packet length failed. Status=MQTTRecvFailed�[0m

�[2K�[31m[ERR ][TLSW]: mbedtls_ssl_read() failed: -0x7200 (-29184): SSL - An invalid SSL record was received�[0m

�[2K�[31m[ERR ][AWS SDK]: Exiting process loop due to failure: ErrorStatus=MQTTRecvFailed�[0m

�[2K�[31m[ERR ][AWS SDK]: A single byte was not read from the transport: transportStatus=-3012.�[0m

�[2K�[31m[ERR ][AWSClient]: MQTT ProcessLoop error: 4�[0m

�[2K�[31m[ERR ][AWS SDK]: Receiving incoming packet length failed. Status=MQTTRecvFailed�[0m

�[2K�[31m[ERR ][Main]: AWSClient::processResponses() failed�[0m

�[2K�[31m[ERR ][AWS SDK]: Exiting process loop due to failure: ErrorStatus=MQTTRecvFailed�[0m

�[2K�[31m[ERR ][AWS SDK]: Exiting process loop due to failure: 84): SSL - An invalid SSL record was received�[0m

�[2K�[31m[ERR ][AWSClient]: MQTT ProcessLoop error: 4�[0m

�[2K�[31m[ERR ][AWS SDK]: A single byte was not read from the transport: transportStatus=-3012.�[0m

�[2K�[31m[ERR ][Main]: AWSClient::downloadShadowDocument() failed: 4�[0m

�[2K�[31m[ERR ][AWS SDK]: Receiving incoming packet length failed. Status=MQTTRecvFailed�[0m

�[2K�[31m[ERR ][AWS SDK]: Receiving incoming packet length failed. Status=MQTTRecvFailed�[0m

�[2K�[31m[ERR ][AWS SDK]: Exiting process loop due to failure: ErrorStatus=MQTTRecvFailed�[0m

�[2K�[31m[ERR ][AWSClient]: MQTT ProcessLoop error: 4�[0m

�[2K�[31m[ERR ][Main]: AWSClient::processResponses() failed�[0m

�[2K�[39m[INFO][AWS SDK]: Disconnected from the broker.�[0m

�[2K�[39m[INFO][TLSW]: Closing TLS�[0m

�[2K�[39m[INFO][Main]: End of the demo�[0m

Target(s) affected by this defect ?

FRDM-K64F

Toolchain(s) (name and version) displaying this defect ?

MBED 6.13.0, Mbed Studio 1.4.4

What version of Mbed-os are you using (tag or sha) ?

mbed-os 6.13.0

What version(s) of tools are you using. List all that apply (E.g. mbed-cli)

Mbed studio 1.4.4

How is this defect reproduced ?

Create demo project
Configure for Device Shadow
Increase size of shadow until crash is observed, example shadow above in description
boraozgen commented 1 year ago

Did you try increasing the buffer sizes in the config?

Spinnaker-design commented 1 year ago

Yes, but that didn't address the issue.

I was able to temporarily resolve it by decreasing the call frequency of the process_responses() call from 10ms to 1s. It seems as though there is some sort of memory corruption that can happen by calling client.processResponses()