Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ESP32: Set optimal CHIP task stack size for ESP32 #4757

Merged
merged 1 commit into from
Feb 10, 2021

Conversation

sweetymhaiske
Copy link
Contributor

@sweetymhaiske sweetymhaiske commented Feb 9, 2021

Problem

Investigate a drastic increase in CHIP task stack size and find the optimal value for CONFIG_CHIP_TASK_STACK_SIZE

Summary of Changes

Set the CHIP task stack size to 5K.
Performed the below test
We checked the working of code with CHIP task stack size as 4608 on both M5Stack and DevkitC followed by pairing(via BLE and WiFi) -> toggling on on/off cluster -> reset to factory -> repeat. It worked fine, leaving the minimum free stack size as 400, which was checked using FreeRTOS API uxTaskGetStackHighWaterMark. These observations were tried out on latest code with commit id - 9318d13. On the safer side, we have set it to 5K.
Fixes #1150

@dhrishi
Copy link
Contributor

dhrishi commented Feb 9, 2021

LGTM wrt the comment here

@mspang
Copy link
Contributor

mspang commented Feb 9, 2021

How likely are we to know if we accidentally exceed the stack limit again?

@dhrishi
Copy link
Contributor

dhrishi commented Feb 9, 2021

How likely are we to know if we accidentally exceed the stack limit again?

With around 400 bytes of minimum free stack size during secure pairing + cluster control, the chances of stack overflow are pretty less. Also, this was done when stack size was 4.5KB. In this PR, we've set it to 5KB to be on the safer side.
In addition to this, we had setup a script that did secure pairing -> onoff cluster control -> reset to factory in a loop and it was carried out for ~30 iterations without any issue.

@woody-apple
Copy link
Contributor

@saurabhst ?

@woody-apple woody-apple merged commit 1813d23 into project-chip:master Feb 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Investigate ESP32 Stack Growth
7 participants