Weird hang crash lwip stack overflow behaviour after OTA download is complete
Posted: Sat Apr 02, 2022 5:30 pm
In IDF4.4 OTA nearly exactly the same as the advanced OTA example.
Noticed that sometimes the device hangs/crashes and even the WDT does not get involved reboot. But we see messages from wifi:
Other times, it just works and the code reaches esp_restart();
Other times, an actual SO is produced. This happens more if we increase the taskdelay.
It looks like the tiT task is the lwip TCPIP task with a default stack size of 2048. Not sure if this needs an increase, but not sure if that's the root cause of the crash.
Here's the code at the end of the OTA download. The rest of the process is the same as OTA advanced example. There are also other tasks in the application. But they do not use net_if/TCPIP.
This was not happening prior to upgrade to 4.4 from 4.0.
Am I doing something wrong?
Noticed that sometimes the device hangs/crashes and even the WDT does not get involved reboot. But we see messages from wifi:
Code: Select all
I (143926) esp_image: Verifying image signature...
I (143926) secure_boot_v2: Take trusted digest key(s) from eFuse block(s)
I (143936) secure_boot_v2: #0 app key digest == #0 trusted key digest
I (143936) secure_boot_v2: Verifying with RSA-PSS...
I (144026) secure_boot_v2: Signature verified successfully!
I (144096) HTTP_CLIENT: ESP_HTTPS_OTA upgrade successful. Rebooting ...
I (147096) wifi:state: run -> init (0)
I (147096) wifi:pm stop, total sleep time: 98307291 us / 140397706 us
W (147096) wifi:<ba-del>idx
I (147096) wifi:new:<11,0>, old:<11,0>, ap:<255,255>, sta:<11,0>, prof:1
W (147106) wifi:hmac tx: ifx0 stop, discard
W (147106) wifi:hmac tx: ifx0 stop, discard
<---- HANGS HERE ---->
Other times, an actual SO is produced. This happens more if we increase the taskdelay.
It looks like the tiT task is the lwip TCPIP task with a default stack size of 2048. Not sure if this needs an increase, but not sure if that's the root cause of the crash.
Code: Select all
I (128002) secure_boot_v2: Take trusted digest key(s) from eFuse block(s)
I (128002) secure_boot_v2: #0 app key digest == #0 trusted key digest
I (128002) secure_boot_v2: Verifying with RSA-PSS...
I (128092) secure_boot_v2: Signature verified successfully!
I (128092) HTTP_CLIENT: ESP_HTTPS_OTA upgrade successful. Rebooting ...
I (131092) wifi:state: run -> init (0)
I (131092) wifi:pm stop, total sleep time: 82194662 us / 124457581 us
W (131092) wifi:<ba-del>idx
I (131092) wifi:new:<11,0>, old:<11,0>, ap:<255,255>, sta:<11,0>, prof:1
W (131102) wifi:hmac tx: ifx0 stop, discard
W (131102) wifi:hmac tx: ifx0 stop, discard
***ERROR*** A stack overflow in task tiT has been detected.
Backtrace:0x40081ce2:0x3ffd5b900x400919a9:0x3ffd5bb0 0x40094bc2:0x3ffd5bd0 0x40093521:0x3ffd5c50 0x40091aa8:0x3ffd5c80 0x40091a5a:0x00000000 |<-CORRUPTED
0x40081ce2: panic_abort at C:/Users/user/esp-idf-v4.4/components/esp_system/panic.c:402
0x400919a9: esp_system_abort at C:/Users/user/esp-idf-v4.4/components/esp_system/esp_system.c:121
0x40094bc2: vApplicationStackOverflowHook at C:/Users/user/esp-idf-v4.4/components/freertos/port/xtensa/port.c:394
0x40093521: vTaskSwitchContext at C:/Users/user/esp-idf-v4.4/components/freertos/tasks.c:3506
0x40091aa8: _frxt_dispatch at C:/Users/user/esp-idf-v4.4/components/freertos/port/xtensa/portasm.S:436
0x40091a5a: _frxt_int_exit at C:/Users/user/esp-idf-v4.4/components/freertos/port/xtensa/portasm.S:231
Code: Select all
ota_finish_err = esp_https_ota_finish(https_ota_handle);
if ((err == ESP_OK) && (ota_finish_err == ESP_OK)) {
ESP_LOGI(TAG, "ESP_HTTPS_OTA upgrade successful. Rebooting ...");
vTaskDelay(3000 / portTICK_PERIOD_MS);
esp_restart();
}
Am I doing something wrong?