GoogleCloudPlatform / iot-device-sdk-embedded-c

Cloud IoT Device SDK for Connectivity to IoT Core.
Other
247 stars 83 forks source link

Memory limiter breaks heap of other tasks using mbedtls on ESP32 #115

Open DaStoned opened 3 years ago

DaStoned commented 3 years ago

Hi!

The memory limiter installs custom malloc/free handlers in mbedtls to do its tracking, and restores the default handlers when done. Unfortunately this breaks other tasks which are using mbedtls at the same time - e.g. HTTPS client on ESP IDF. When the magic malloc headers installed this library no longer make sense, the default handlers will assume memory corruption and crash.

Original bug report in the ESP IDF port of this project and an in-depth diagnosis of the issue by an Espressif developer is available here: https://github.com/espressif/esp-google-iot/issues/18#issuecomment-746988438

When network connects, a lot of network-dependent modules typically start their work in parallel. Hence the issue is quite severe in my opinion.