You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Reason for creating this as a new issue is that we have created simple reproducer where Cont stack keeps growing even if same function called in loop repeatedly. Since we are not using any ticker or similar kind of code where callbacks could affect sys stack so problem seems to be related to cont stack / Serial.printf implementation
We could understand higher watermark of cont stack when function is called for the first time with maximum array size of 500 to be printed but it keeps increasing (reducing free stack size) in repeated loop calls for same function though frequency of stack increase reduces with time.
It can be reproduced with Generic ESP8266 module/board. We used ESP-12F. Please see the logs running loop for 1000 times.
You can observer that before starting the loop available stack size was 3280 and after first function call free stack size is reduced to 3216. May be stack is freed and it just a watermark that stays to 3216.
However in logs, you can observe following
On Loop count 20, Available Cont stack size reduced to 3136
On Loop count 27, Available Cont stack size reduced to 2960
On Loop count 46, Available Cont stack size reduced to 2944
On Loop count 608, Available Cont stack size reduced to 2864
We are not clear if stack is growing or just watermark is growing. Need your help to understand
Even if it is watermark why it keeps growing when same function is called.
As there is no recursion, empty variable so there is no reason for stack/watermark to grow.
In our actual implementation with large code base (Issue ESP8266 Crashing During Prints randomly #9069) if we enable logs (Serial.printf) we are reaching to a point where we see free cont stack reduces to 0 just before system report stack smashing and reboots. So it is very important to understand, should it grown is this sample sketch, if yes, under what circumstances?
Is it a bug or expected behavior, if expected behavior, a reasonable explanation will be helpful because our system is expected to work for months with reboot/power cycle and we may need to enable prints to catch field issues and enabling prints is causing stack smashing.
Only watermark is growing. You can repaint stack with ESP.resetFreeContStack();.
I've tested your sketch with stack repaint on every loop. getFreeContStack() changes a lot, by about 300 bytes at least. But always returns to start value after repaint.
At start:
Cont Free stack Size After Prints: 2928
Looping Again... Count: 19
Cont Free stack Size Before Prints: 3280
After some time:
Cont Free stack Size After Prints: 2944
Looping Again... Count: 4847
Cont Free stack Size Before Prints: 3280
Basic Infos
Platform
Settings in IDE
Problem Description
This issue is somewhat related to following issue.
#5148
#9069
and following post
https://www.esp8266.com/viewtopic.php?p=87105
Reason for creating this as a new issue is that we have created simple reproducer where Cont stack keeps growing even if same function called in loop repeatedly. Since we are not using any ticker or similar kind of code where callbacks could affect sys stack so problem seems to be related to cont stack / Serial.printf implementation
We could understand higher watermark of cont stack when function is called for the first time with maximum array size of 500 to be printed but it keeps increasing (reducing free stack size) in repeated loop calls for same function though frequency of stack increase reduces with time.
It can be reproduced with Generic ESP8266 module/board. We used ESP-12F. Please see the logs running loop for 1000 times.
You can observer that before starting the loop available stack size was 3280 and after first function call free stack size is reduced to 3216. May be stack is freed and it just a watermark that stays to 3216.
However in logs, you can observe following
On Loop count 20, Available Cont stack size reduced to 3136
On Loop count 27, Available Cont stack size reduced to 2960
On Loop count 46, Available Cont stack size reduced to 2944
On Loop count 608, Available Cont stack size reduced to 2864
MCVE Sketch
Debug Messages
The text was updated successfully, but these errors were encountered: