-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
nrf5: Enlarge stack to fix thread join overruns #2189
nrf5: Enlarge stack to fix thread join overruns #2189
Conversation
As of b15c292 ("[nrf5-lock] start joiner role on boot (project-chip#1962)"), we are using too much stack space in timer task. The timer task has a 1k stack and logging along uses a 256 byte stack buffer. The code in GenericThreadStackManagerImpl_FreeRTOS<ImplClass>::OnJoinerTimer should be moved off the timer task. In the meantime increase the stack size to avoid overruns in the thread joiner. Also enable the option configCHECK_FOR_STACK_OVERFLOW, and while we're here also enable configUSE_MALLOC_FAILED_HOOK. These diagnostic options are invaluable for saving debugging time. Since logging uses significant stack space, try to catch stack overflows in the platform LogV(). This fires reliably in OnJoinerTimer prior to enlarging the stack. Fixes project-chip#2187
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Size increase report for "gn_nrf-example-build"
Full report output
|
Size increase report for "gn_linux-example-build"
Full report output
|
Size increase report for "nrf-example-build"
Full report output
|
Size increase report for "nrfconnect-example-build"
Full report output
|
Size increase report for "linux-example-build"
Full report output
|
Size increase report for "esp32-example-build"
Full report output
|
This patch contains all the diagnostic enhancements; we should land at least those. I'm a bit busy to retest it, I think we should land this as-is and then make a followup to set it back to 1k. That way if there's still an overrun at 1k we can just revert the followup. |
This appears to still be broken. |
Actually, I'm seeing a different (unrelated) issue now |
As of b15c292 ("[nrf5-lock] start joiner role on boot (#1962)"),
we are using too much stack space in timer task. The timer task has a 1k
stack and logging alone uses a 256 byte stack buffer.
The code in
GenericThreadStackManagerImpl_FreeRTOS<ImplClass>::OnJoinerTimer
shouldbe moved off the timer task. In the meantime increase the stack size
to avoid overruns in the thread joiner.
Also enable the option
configCHECK_FOR_STACK_OVERFLOW
, and while we'rehere also enable
configUSE_MALLOC_FAILED_HOOK
. These diagnostic optionsare invaluable for saving debugging time.
Since logging uses significant stack space, try to catch stack overflows
in the platform
LogV()
. This fires pretty reliably inOnJoinerTimer
priorto enlarging the stack.
Fixes #2187