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

Possible memory leak? #189

Open
EdMatheson opened this issue Aug 9, 2021 · 1 comment
Open

Possible memory leak? #189

EdMatheson opened this issue Aug 9, 2021 · 1 comment

Comments

@EdMatheson
Copy link

First of all, I would like to complement you guys for an awesome app and web site. I can tell a lot of hard work went into it.

However, I have found an issue and I am not sure its a problem with the library or how I am using it.
My apps in the field would start working erratically or crash after a few days of operation that included calling home. I found that the available heap was constantly being diminished over time. First, thinking my code was the problem, I begin to cut parts of my app trying to find the source of the problem. I finally got down to just the appstory code and still had the the issue.
To confirm this, I made a very simple program (derived from your virgin soil example) that just used appstory to call home (every 10 minutes), blink an led once a second, and print the available heap every 100 seconds (code shown below). When run the available heap can be seen to slowly decrease until the code can't call home successfully and then finally dies.


#define COMPDATE DATE TIME
#define MODEBUTTON 0

#include <IOTAppStory.h> // IotAppStory.com library
IOTAppStory IAS(COMPDATE, MODEBUTTON); // Initialize IotAppStory

#define ledPin 25 //for heltec
//#define ledPin 13 //for feather

// ================================================ SETUP ================================================
void setup() {

IAS.begin(); // Run IOTAppStory

IAS.setCallHomeInterval(600);
//-------- Your Setup starts from here ---------------

//while (!Serial); // get serial ready
Serial.begin(115200);
delay(1000);
Serial.println("Serial up");
Serial.println("This bare appstory ");

pinMode(ledPin, OUTPUT);
}


The code was compiled with the latest Arduino IDE using the Arduino esp32 BSP ver 1.0.5 and the appstory library version 2.1.0-RCS5.1.
It was executed on both an Adafruit ESP32 feather and a Heltec WiFi Kit 32 with the same results.
Could you guys run my example and see if you can duplicate the issue or just give me a hint on where I am going wrong.

@antonmeyer
Copy link

antonmeyer commented Jan 2, 2022

I can confirm the same or similar issue. My project was tested several days with stable heap.
Now with IOTAppStory heap is eaten within 40min, calling home every 60s.

Ends up in

Returning from IOTAppStory.com
-------------------------------------------------------------------------
Calling Home

Checking for App(Sketch) updates from: https://iotappstory.com/ota/updates
[E][ssl_client.cpp:36] _handle_error(): [start_ssl_client():207]: (-32512) SSL - Memory allocation failed
[E][WiFiClientSecure.cpp:133] connect(): start_ssl_client: -32512
ERROR: connection failed

Checking for SPIFFS updates from: https://iotappstory.com/ota/updates
[E][ssl_client.cpp:36] _handle_error(): [start_ssl_client():207]: (-32512) SSL - Memory allocation failed
[E][WiFiClientSecure.cpp:133] connect(): start_ssl_client: -32512
ERROR: connection failed

Returning from IOTAppStory.com
-------------------------------------------------------------------------
[E][ssl_client.cpp:36] _handle_error(): [start_ssl_client():138]: (-10368) X509 - Allocation of memory failed
[E][WiFiClientSecure.cpp:133] connect(): start_ssl_client: -10368
InfluxDB write failed: connection refused
Calling Home
[E][EEPROM.cpp:136] begin(): Not enough memory for 16711680 bytes in EEPROM

Checking for App(Sketch) updates from: https://iotappstory.com/ota/updates
Could not load Certificate!
[E][EEPROM.cpp:136] begin(): Not enough memory for 0 bytes in EEPROM
https://iotappstory.com/ota/updates
Could not load Certificate!

Returning from IOTAppStory.com
-------------------------------------------------------------------------
Calling Home
[E][EEPROM.cpp:136] begin(): Not enough memory for 16711680 bytes in EEPROM

Checking for App(Sketch) updates from: https://iotappstory.com/ota/updates
Could not load Certificate!
[E][EEPROM.cpp:136] begin(): Not enough memory for 0 bytes in EEPROM
https://iotappstory.com/ota/updates
Could not load Certificate!

Returning from IOTAppStory.com

I will do some tests with examples.
I had some problems with the initial setup of esp32 and IOTAppStory-Portal.
I use board_build.partitions = min_spiffs.csv

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants