Based on my past experience resolving errors I’m quite certain its user user error 
I’m seeing this same error in 2.17.0 as well as 2.18.0.
I get this which is why I declare the parameters are a global level as static. Am I wrong to assume this means they won’t ever be trashed?
My program is getting pretty long, so I’ll try to summarise the main bits:
#include "mgos_i2c.h"
#include "mgos_si7021.h"
static struct mgos_i2c *i2c;
static struct mgos_si7021 *s_si7021;
static void read_temp(void *user_data)
{
(void)user_data;
double temp_offset = 1.55;
current_inside_temp = temp_offset + mgos_si7021_getTemperature(s_si7021);
current_inside_humidity = mgos_si7021_getHumidity(s_si7021);
}
enum mgos_app_init_result mgos_app_init(void)
{
// Setup i2c bus and temp sensor
i2c = mgos_i2c_get_global();
s_si7021 = mgos_si7021_create(i2c, 0x40); // Default I2C address
mgos_set_timer(15000, MGOS_TIMER_REPEAT, read_temp, NULL); // every fifteen seconds
return MGOS_APP_INIT_SUCCESS;
}
The program will run for hours getting a new temp every 15 seconds then all of a sudden core-dump with the following error:
Dump contains FreeRTOS task info
Loaded core dump from last snippet in /core
0x4010093e in mgos_si7021_read (sensor=0xf2)
at /home/andrew/Code/mongoose/deps/si7021-i2c/src/mgos_si7021.c:82
82 if (!sensor || !sensor->i2c) {
#0 0x4010093e in mgos_si7021_read (sensor=0xf2)
at /home/andrew/Code/mongoose/deps/si7021-i2c/src/mgos_si7021.c:82
---Type <return> to continue, or q <return> to quit---
#1 0x40100b5c in mgos_si7021_getTemperature (sensor=0xf2)
at /home/andrew/Code/mongoose/deps/si7021-i2c/src/mgos_si7021.c:149
No idea why the var would be trashed after a number of hours. Overnight I had 2 core dumps on this, and now it’s been up for 10+ hours.
I was thinking that my program eventually runs out of memory and its just pointing there? Not sure how this would happen, I’m logging mgos_get_free_heap_size
and mgos_get_min_free_heap_size
regularly and don’t seem them meet.
I would have expected that if I had an overflow somewhere in my program writing to memory it shouldn’t then I would have found out sooner than 10h+, and then would have seen a guru meditation error or something.
I’m thinking now of a way to hard code the struct values in the lib and see if that points to something else going on.