Stack overflow but uxTaskGetStackHighWaterMark much smaller
Posted: Mon May 10, 2021 8:34 am
Hi,
I am trying to reduce my stack utilization in a customer project right now. So far I have no stripped down code to share, but I am working on it. But the question might be answered without it.
I have some code working in event loop.
When I set the stack size to 6000 for each and check the watermark of my event loops (2 loops), they show me
But when I reduce the stack size of my Sns2 to 4000, I get something like
Maybe to mention: The call in the event callback to Sns2 triggers Sns1.
No my question:
How is it possible to run in a stack overflow with a stack size of 4000, if my water mark shows my a maximum which is much smaller?
I am trying to reduce my stack utilization in a customer project right now. So far I have no stripped down code to share, but I am working on it. But the question might be answered without it.
I have some code working in event loop.
When I set the stack size to 6000 for each and check the watermark of my event loops (2 loops), they show me
Code: Select all
I (09:19:07.443) Common: task prio watermark
I (09:19:10.795) Common: Sns1EvtTsk 24 1072
I (09:19:10.800) Common: Sns2EvtTsk 24 584
Code: Select all
I (09:17:05.262) Snsor1: [1620638226000] measuring now ...
***ERROR*** A stack overflow in task RtcEvtTsk has been detected.
Backtrace:0x400d2d93:0x3ffb96700x400873b9:0x3ffb9690 0x4008a569:0x3ffb96b0 0x400890b5:0x3ffb9730 0x400874b8:0x3ffb9750 0x4008746a:0x00000000 |<-CORRUPTED
0x400d2d93: panic_abort at /home/user/dev/official/esp-idf/components/esp_system/panic.c:354
0x400873b9: esp_system_abort at /home/user/dev/official/esp-idf/components/esp_system/esp_system.c:126
0x4008a569: vApplicationStackOverflowHook at /home/user/dev/official/esp-idf/components/freertos/port/xtensa/port.c:490
0x400890b5: vTaskSwitchContext at /home/user/dev/official/esp-idf/components/freertos/tasks.c:3274
0x400874b8: _frxt_dispatch at /home/user/dev/official/esp-idf/components/freertos/port/xtensa/portasm.S:432
0x4008746a: _frxt_int_exit at /home/user/dev/official/esp-idf/components/freertos/port/xtensa/portasm.S:231
No my question:
How is it possible to run in a stack overflow with a stack size of 4000, if my water mark shows my a maximum which is much smaller?