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

Increasing CHIP_TASK_STACK_SIZE from 4096 -> 5120 #8216

Merged

Conversation

mgarb1
Copy link
Contributor

@mgarb1 mgarb1 commented Jul 8, 2021

Problem

What is being fixed? Examples:-

  • Fix crash when provisionen a Thread devices on TI platform due to low memory

Change overview

Increasing CHIP_TASK_STACK_SIZE from 4096 -> 5120

Testing

Tested on physical device and provisioning do not get memory error anymore.

@CLAassistant
Copy link

CLAassistant commented Jul 8, 2021

CLA assistant check
All committers have signed the CLA.

@mgarb1 mgarb1 changed the title Increasing HANDLER_STACK_SIZE from 4096 -> 5120 Increasing CHIP_TASK_STACK_SIZE from 4096 -> 5120 Jul 8, 2021
Copy link
Contributor

@andy31415 andy31415 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The need for such a large stack is somewhat concerning.

Copy link
Contributor

@bzbarsky-apple bzbarsky-apple left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be changed in this central location, or for this specific platform? Other platforms already override this...

Copy link
Contributor

@bzbarsky-apple bzbarsky-apple left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be changed for the relevant platform, not globally.

@mgarb1
Copy link
Contributor Author

mgarb1 commented Jul 9, 2021

@bzbarsky-apple The stack increase is now done on platform level instead og globally. Tested and is working. Please see 12f48da

@andy31415
Copy link
Contributor

This should be changed for the relevant platform, not globally.

I had a similar thought, however I also wondered what would make TI special here - I would have assumed that the chip stack is quite low level and its stack usage should not differ greatly between platforms.

@mgarb1 Do we know what code path causes the overflow? That may help us in determining if this is really platform-specific or if this is just the platform that found it (and others happily corrupt memory).

@mgarb1
Copy link
Contributor Author

mgarb1 commented Jul 9, 2021

@andy31415 The stack increase is done on platform level instead of globally. Tested and is working. Please see 12f48da

@srickardti @andy31415 is asking "Do we know what code path causes the overflow? That may help us in determining if this is really platform-specific or if this is just the platform that found it (and others happily corrupt memory)." can you answer this?

@srickardti
Copy link
Contributor

@mgarb1 @andy31415 I haven't investigated this specifically, but we could add a watchpoint at the top of the stack. The issue I've found in debugging these things is the stack check feature of the kernel is done in the idle loop or in a context switch, not when it actually pops the stack.

I have noticed that other platforms have very large callstacks, larger than this.

In the past I've seen these issues caused by log messages. snprintf has no problem allocating hundreds of bytes on the stack to build its message. If the stack is filled with space characters (0x20) there's a good chance snprintf was using that as scratch space.

@bzbarsky-apple bzbarsky-apple merged commit ce3ea56 into project-chip:master Jul 9, 2021
andy31415 pushed a commit that referenced this pull request Jul 9, 2021
* Increasing HANDLER_STACK_SIZE from 4096 -> 5120

* increase CHIP_TASK_STACK_SIZE 4096 - > 5120

* Increasing the Stack size on platform level instead of globally
@mgarb1 mgarb1 deleted the fix_provisioning_TI_platform branch August 5, 2021 21:34
nikita-s-wrk pushed a commit to nikita-s-wrk/connectedhomeip that referenced this pull request Sep 23, 2021
* Increasing HANDLER_STACK_SIZE from 4096 -> 5120

* increase CHIP_TASK_STACK_SIZE 4096 - > 5120

* Increasing the Stack size on platform level instead of globally
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants