Heap memory has degraded below safe minimum

The last successful upload to emonCMD or influx from my iota was on 3/12. The log file refers to a few “heap memory has degraded below safe minimum, restarting” issues prior to this date. Wi-Fi quality has been poor (-80 db-ish). LED has been fast flashing green.

I’ve tried a power reset with no success, and significantly improved Wi-Fi quality (-55 db). No access at iotawatt.local. I then deleted the current log file (IOTALOG.LOG) manually from the SD card. Thereafter the device was accessible at iotawatt.local and was successfully uploading to emon and influx for about 20 mins or so before it stopped again.

Log file attached - any ideas? It’s an iotawatt from one of the earliest production runs.

IOTAMSGS.TXT (954.7 KB)

Looking at the log for the last couple of months, the WiFi was very bad. The heap memory degradation, I have come to correlate with poor WiFi. I believe that there is a memory leak in the low level Lightweight IP (lwip) code that is p[art of the ESP8266 core. Devices with solid WiFi run indefinitely with no heap degradation. Systems with WiFi errors will lose a chunk from time to time until it drops below a threshold in the IoTaWatt firmware that “fixes” it with a restart. The restart is harmless really as it only takes a few seconds and it does it when things are otherwise quiet.

What disturbs me more is the string of power cycles during February. I’d like to know more about what caused those or why.

Eventually, the current log does appear to have been damaged, at:
dataLog: Last log entry 03/12/19 02:30:00
Oddly, there is nothing unusual going on at that point in time, which leads me to believe that the SDcard may have been structurally damaged during the rapid power cycling earlier in the month.

So while I don’t know exactly why it stopped working now, I’m pretty sure the solution is a new SDcard. You will need a clean 8gb card. Copy all of the files in the root directory. They are:

2/11/19 22:34:33z Updater: Installing GRAPH.HTM
2/11/19 22:34:33z Updater: Installing GRAPH.JS
2/11/19 22:34:34z Updater: Installing INDEX.HTM
2/11/19 22:34:35z Updater: Installing TABLES.TXT
2/11/19 22:34:35z Updater: Installing CNFSTYLE.CSS
2/11/19 22:34:35z Updater: Installing EDIT.HTM 

and of course CONFIG.TXT

If you want to try to recover your history, you can copy /iotawatt/histlog.log, although if you subsequently have trouble you will need to delete the history log. I give it a 60-40 chance of working.

That should get you going, but the underlying WiFi must be improved for good long term operation.

Terrific, thanks. Copying the files (including the history) to another SD card did the trick. It would appear likely that the power outages did indeed corrupt the SD card. Now all resolved (at least, based on the last two hrs of stable performance).

1 Like