espressif / esp-rainmaker

ESP RainMaker Agent for firmware development
Apache License 2.0
432 stars 145 forks source link

Time Series runs out of memory (MEGH-3870) #176

Closed rakosi2 closed 1 year ago

rakosi2 commented 1 year ago

I enabled Time Series and my ESP32 will crash and restart. After a little bit, my console gets flooded with messages like

rtc_store_non_critical_data_write failed group wifi, len 40, err 0x0101 and W (181294) wifi_metrics: Failed to add Wi-Fi metrics key:rssi

after a while of that, I get the following print before a forced restart:

Guru Meditation Error: Core  0 panic'ed (LoadProhibited). Exception was unhandled.

Core  0 register dump:
PC      : 0x400db805  PS      : 0x00060c30  A0      : 0x800dbda6  A1      : 0x3ffb14c0  
0x400db805: __esp_rmaker_param_report_time_series at esp-rainmaker/components/esp_rainmaker/src/core/esp_rmaker_param.c:752
 (inlined by) esp_rmaker_param_report_time_series at esp-rainmaker/components/esp_rainmaker/src/core/esp_rmaker_param.c:783
 (inlined by) esp_rmaker_param_report_time_series at esp-rainmaker/components/esp_rainmaker/src/core/esp_rmaker_param.c:762

A2      : 0x00000000  A3      : 0x3ffbf4ec  A4      : 0x3ffe8f64  A5      : 0x3ffaf398  
A6      : 0x00000000  A7      : 0x00000000  A8      : 0x800db801  A9      : 0x3ffb14a0  
A10     : 0x00000000  A11     : 0x3f408c5e  A12     : 0x3f408c43  A13     : 0x00000000  
A14     : 0x3ffe8fa0  A15     : 0x00000000  SAR     : 0x0000000c  EXCCAUSE: 0x0000001c  
EXCVADDR: 0x00000000  LBEG    : 0x400014fd  LEND    : 0x4000150d  LCOUNT  : 0xffffffff  

Backtrace: 0x400db802:0x3ffb14c0 0x400dbda3:0x3ffb1560 0x400d79f8:0x3ffb1590
0x400db802: __esp_rmaker_param_report_time_series at esp-rainmaker/components/esp_rainmaker/src/core/esp_rmaker_param.c:752
 (inlined by) esp_rmaker_param_report_time_series at esp-rainmaker/components/esp_rainmaker/src/core/esp_rmaker_param.c:783
 (inlined by) esp_rmaker_param_report_time_series at esp-rainmaker/components/esp_rainmaker/src/core/esp_rmaker_param.c:762

0x400dbda3: esp_rmaker_param_update_and_report at esp-rainmaker/components/esp_rainmaker/src/core/esp_rmaker_param.c:817
 (inlined by) esp_rmaker_param_update_and_report at esp-rainmaker/components/esp_rainmaker/src/core/esp_rmaker_param.c:811

0x400d79f8: teleLoop at main/app_main.c:219

I am unsure if there is something I need to change in menuconfig for Time Series to work correctly.

I do get a few of these prints starting up but I think that is another issue: E (1373) esp_rmaker_device: Parameter with name ... already exists in Device E (11688) esp_rmaker_param: Current time not yet available. Cannot report time series data.

shahpiyushv commented 1 year ago

@rakosi2 , thanks for reporting this. A check would be required to prevent the crash. However, the actual issue is that the param has not been added to the device, as you can see in this error message.

E (1373) esp_rmaker_device: Parameter with name ... already exists in Device

So, the param object does not have a parent, which we are trying to access in the time series call, without a NULL check.