-
Notifications
You must be signed in to change notification settings - Fork 38
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
esp_zb_init causes heap corruption/ overrides something important? (TZ-1469) #534
Comments
I checked it and couldn't find anything more, commenting zigbee init fixes everything. |
This log indicates the |
I did not try, but this stack has been like this for 2 years tested by 300000+ users, when I comment out zigbee init it doesn't overflow. I will increase the stack and check it |
Additionally, this stack crashes when it is getting ntp time right after starting. So there is nothing that could overflow it. |
I think I figured it out. Zigbee sdk does something with uart logger and it causes to allocate more memory after log when zigbee SDK was initlized. To reproduce it try starting a thread like this
Wait for some time to check the watermark and then start ZigBee, logger should allocate additional memory after Zigbee was initialized |
Based on your description, Do you suspect that the esp_zb_init() allocate some extra common memory which affect other tasks? Due to the log from the |
I will create an example of that behaviour. |
https://github.com/damian-kurek-wizzdev/zigbee/tree/zigbee_logs_problem |
Answers checklist.
IDF version.
5.1.2
esp-zigbee-lib version.
1.6.0
esp-zboss-lib version.
1.6.0
Espressif SoC revision.
esp32c6
What is the expected behavior?
No crash
What is the actual behavior?
So I integrated Zigbee sdk with the existing code base and I noticed that I got stack overflow in random lines in the thread that was not touched for year+. After debugging the issue for some time I noticed that if I comment out esp_zb_init everything works fine.
esp_zb_cfg_t zb_nwk_cfg = {}; zb_nwk_cfg.esp_zb_role = ESP_ZB_DEVICE_TYPE_ED; zb_nwk_cfg.install_code_policy = INSTALLCODE_POLICY_ENABLE; zb_nwk_cfg.nwk_cfg.zed_cfg.ed_timeout = ED_AGING_TIMEOUT; zb_nwk_cfg.nwk_cfg.zed_cfg.keep_alive = ED_KEEP_ALIVE; esp_zb_init(&zb_nwk_cfg);
I don't need to do anything with zigbee e.g. run zigbee loop and it will trigger the crash in different thread
Steps to reproduce.
Hard to tell how to reproduce it I have 18 threads running so you probably need firmware that uses a lot of threads, so Zigbee can override it.
More Information.
I will come back to debugging this tomorrow, maybe I can find some more info, if you need me to check something just write a comment.
Attaching the core dump from UART.
core_dump.txt
I tried to enable heap corruption tools but did not get anywhere with that
The text was updated successfully, but these errors were encountered: