espressif / esp-iot-bridge

A smart bridge to make both ESP and the other MCU or smart device can access the Internet.
Apache License 2.0
140 stars 49 forks source link

Crash wen SPIRAM is on (AEGHB-334) #55

Open franz-ms-muc opened 9 months ago

franz-ms-muc commented 9 months ago

Crash wen SPIRAM is on

See Log:

https://gist.github.com/franz-ms-muc/8686894498e76fa004879489331b5a3b

running:

https://github.com/franz-ms-muc/esp-iot-bridge/tree/running!

crashing:

https://github.com/franz-ms-muc/esp-iot-bridge/tree/crashing!

tswen commented 9 months ago

Hello, may I ask which version of the idf you are using? I recommend trying with idf version 5.0.

m5it commented 9 months ago

me still on 4 didnt notice no problems. only that it leak of memory when x users are connected.. :)

tswen commented 9 months ago

In general, whenever a child node connects to the hotspot of a parent node, the parent node will consume nearly 2k of memory. This is a necessary consumption on the Wi-Fi side, and I'm not sure if the memory leak you mentioned refers to this memory consumption.

franz-ms-muc commented 9 months ago

Hello, may I ask which version of the idf you are using? I recommend trying with idf version 5.0.

ESP-IDF Release v5.1

let me go for a test with

ESP-IDF Release v5.0.3

so, result is that it is same. still crash when spiram on.

franz-ms-muc commented 9 months ago

i will test with 4.4.5 as well. ..

not crash even with SPIRAM on. https://github.com/franz-ms-muc/esp-iot-bridge/tree/feature/wifi_router2

https://gist.github.com/franz-ms-muc/d26679ce9be867906195575d6d4526bc

franz-ms-muc commented 9 months ago

there is still a Bug inside when using 4.4.5

see: https://github.com/franz-ms-muc/esp-iot-bridge/blob/ce247a249bc450469f42eb60fbd34b2d399e3800/main/app_main.c#L142 https://gist.github.com/franz-ms-muc/d999eb38eda77a0ab76bb2ca3220c935

after running the Sample all SPIRAM is gone, even if we have a lot before:

before: MALLOC_CAP_: 8bit 4454202, 32bit 4488546, SPIRAM 4192135 after: MALLOC_CAP_: 8bit 99880, 32bit 134224, SPIRAM -247

so something consumes away the SPIRAM. so i guess Problem always same, just the crash not happening in 4.4.5, because little bit under the Limit.

franz-ms-muc commented 9 months ago

In general, whenever a child node connects to the hotspot of a parent node, the parent node will consume nearly 2k of memory. This is a necessary consumption on the Wi-Fi side, and I'm not sure if the memory leak you mentioned refers to this memory consumption.

no. it is crashing without anybody has connected, directly at boot up.

tswen commented 9 months ago

there is still a Bug inside when using 4.4.5

see: https://github.com/franz-ms-muc/esp-iot-bridge/blob/ce247a249bc450469f42eb60fbd34b2d399e3800/main/app_main.c#L142 https://gist.github.com/franz-ms-muc/d999eb38eda77a0ab76bb2ca3220c935

after running the Sample all SPIRAM is gone, even if we have a lot before:

before: MALLOC_CAP_: 8bit 4454202, 32bit 4488546, SPIRAM 4192135 after: MALLOC_CAP_: 8bit 99880, 32bit 134224, SPIRAM -247

so something consumes away the SPIRAM. so i guess Problem always same, just the crash not happening in 4.4.5, because little bit under the Limit.

I conducted testing using the branch you provided and found that it seems to be the esp_bridge_create_button API that is causing SPIRAM to become negative. Could you try disabling esp_bridge_create_button on your end?