-
Notifications
You must be signed in to change notification settings - Fork 7.3k
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
ASSERT_PARAM(-218959118 0), in arch_main.c at line 365 while using BLE (IDFGH-12768) #13747
Comments
Thank you for reporting the issue. It seems to be related to the BLE controller's memory. The reason for this issue is that the controller failed to allocate memory. We will attempt to replicate the problem. Could you provide a demo that reproduces this issue? This would be helpful in resolving the problem. |
The BLE controller allocates a block of memory during initialization, which is exclusively for the controller's use. There's no way to determine from the outside whether there has been a memory leak in the memory allocated for the controller. |
thanks a lot for the answer. I've spent a lot of time tracking this issue... I switch to IDF 4.4.5, but no improvement. I'll try to patch IDF-4.4.5 BT controller with 4.4.7 BT controller to ensure this issue isn't already fixed in the latest version. Some questions : A said in the first post, it will be very complicated to release a test module if other software parts are involved, but I'll try during next weeks. |
1-Is it possible to observe memory leaks from outside of the BT controller? |
ok, thanks again. |
d166426.zip(based on e8bdaf9 tag: v4.4.4)
code:
log:
|
ok. I am currently trying with IDF 4.4.7 version. |
ok, let's go for a test in IDF 4.4.4 + libbtdm_app.a patch before the long weekend. compilation test :
NimBle function at this line :
build test with ke_get_heap_free_size :
|
in debug level :
|
I managed to remove Tasmota dependencies and work with "pure" packages now (thanks to Jason2866):
here are the IDF 4.4.7 results with stock "libbtdm_app.a" :
board 1 crashed after 52 min, then 11h43m I tried you patched "libbtdm_app.a" with IDF 4.4.7, but it doesn't work ;) |
@Koxx3 |
ok, I'll try to switch back to officiel 4.4.4 and use ke_get_heap_free_size |
I guess there might be a subtle memory leak in the controller. Perhaps some patterns could be discovered by using ke_get_heap_free_size... thanks for your testing. |
argh. I cleaned everything (build folder & cache).
then in main.cpp :
At execution (without using ke_get_heap_free_size), it clearly state I am using d166426 : |
Can you provide me with your current commit ID? I'd like to perform some local testing. |
sorry updated too late : |
how do I do that ? |
|
If you don't call ke_get_heap_free_size, the compilation should still proceed without issues, right? |
yes. and the app runs perfectly with BT |
running logs in debug level : |
yes, it really seems to leak :
|
also, disconnecting and reconnecting BLE doesn't release the memory.
|
If you can analyze the scenarios of memory leaks (broadcasting, scanning, connecting, etc.), it would be very helpful in resolving the issue. |
crash :
Log : |
just before the crash ... lot of "s=12 t=1 in r_ke_malloc_hack 215"
|
Thank you for your feedback. I have identified the memory leak in the ROM code. We need to investigate further, Thank you. |
in the ROM ??? does it means you won't be able to patch/fix it ? |
@Koxx3 Can you help test whether the memory can be recovered after a memory leak by closing all BLE activities (including ADV, SCAN, and connections)? |
When i used ble::deinit, yes, it frees the memory. I've posted some logs above. |
There's no need to disable or deinitialize the BLE host and controller. Simply disconnecting and stopping advertising and scanning. |
BT controller compile version [ffbff3e] |
test with ffbff3e :
Full log : |
Based on your feedback, The memory allocated by "r_ke_timer_set_hack" has not been released. However, I also noticed that there is still data in the queue that hasn't been processed in time. I observed that our program sends a notify signal 4 times within 0.1 seconds, which is a very short interval. Could the reason for the unreleased memory be that the information in the queue hasn't been processed yet? Have you verified whether the memory is released after stopping the scan and advertising, and disconnecting? If the memory is still not released after stopping advertising and scanning, and disconnecting, then we can confirm that there is a memory leak in the internal controller function "r_ke_timer_set_hack." |
1/ The ffbff3e library has a serious issue/crashes !! 2/ My app doesn't advertise once a device is connected 3/ I don't think it's related to the number of messages because : Test : 1 notif every 100ms + scan + no advertising
4/ Have you verified whether the memory is released after stopping the scan and advertising, and disconnecting?
Full log with partial restart : Example of 'restart' :
|
@Koxx3 1-"Cache disabled but cached memory region accessed." I look forward to your feedback. Thank you. my test log: device-monitor-240528-132617.log some code change in my test: |
Thanks. Let's go for a test ! |
@Koxx3 |
24h tests with the example :
stable at ~6400 bytes. I'll continue test within the final app now. Could you please :
Thanks a lot ! |
Unfortunatly, I still have a some crashes.
|
This crash was in my final app.
and sdkconfig :
I'll retry with similar scan params than the example I provided you. |
Can the sdkcondig, active scan or scan param have such impacts ? |
ASSERT_PARAM(4 13), in llm_util.c at line 215 is a known issue,see: |
This is the release version, |
Thanks, i'll be able to test in 8h. |
Running connected & scanning for 14h on 2 boards / 2 phones for now (with 4.4.4). |
Running for 36h without trouble (with 4.4.4). I think we can consider this issue closed ! |
Answers checklist.
General issue report
Environment
Problem Description
My software uses BLE, Wifi (disabled during this test, but enable in sdkconfig), TWAI, UART, SPI, U2C and UART...
It scans for BLE beacons every second while it is connected in BLE to a 1 smartphone, and it reports the detected devices belonging to a custom filtered list with custom BLE characteristics.
Advertising is enabled while the smartphone is connected.
It uses NimBLE.
I crash after 5 to 8h if a smartphone remains connected. I don't see any crash if the smartphone isn't connected.
I've tried many many configurations following similar previous BLE stack errors reported on this github :
Without success ...
Monitoring memory every 1h, I don't see any leak over time.
My sdkconfig : https://pastebin.com/2TzT7sTC
I can't move to higher IDF without a large impact on my software... which is not possible considering we are launching the production soon.
I tried IDF 4.4.5, but it crashes too (I didn't note the exception/backtrace)
Any help please ?
Expected Behaviour
The BLE stack should not panic when scanning.
Actual Behaviour
The application will panic after seemingly non-deterministic intervals, generally during BLE scans.
Steps to reproduce
N/A considering the complexity of the application.
Debug Logs
Decoded stack trace :
Memory left after boot :
CPU usage :
Tasks informations:
The text was updated successfully, but these errors were encountered: