Heap memory problems

For some reason my Iotawatt is restarting every ~10 hours with heap memory problems:

9/15/18 13:42:02 Heap memory has degraded below safe minimum, restarting.

9/16/18 01:28:02 Heap memory has degraded below safe minimum, restarting.

9/16/18 11:48:03 Heap memory has degraded below safe minimum, restarting.

9/16/18 22:07:27 Heap memory has degraded below safe minimum, restarting.

This problem has been started recently.

SW version: 9/15/18 10:42:04z Version 02_03_13
This iotawatt contains 8CT input and 1 VT. Single phase.

BR, Timo

Could you post the message log and configuration file
please? (Remove any EmonCMS keys or send via PM)

I sent files to PM.

BR, Timo

I’ve taken a look at the log and config. There’s no smoking gun with respect to cause, but there are a few issues that, if addressed, could resolve or at least reduce the frequency of this problem.

Looking back at your log, you have had pretty serious communications issues for months, with frequent restarts because of high error counts attempting to post to Emoncms. With the latest release 02_03_13 we get a look at he WiFi quality and it’s not great. The RSSI on connect is typically -80 to -85. The new low level LwIP in this release also seems to be doing a better job, but at each restart, Emoncms updata is still typically 1-2 hours behind.

I’m pretty sure the high error retry rates are eroding the heap memory. There are a few things you can do:

  1. improve the WiFi signal strength. Usually that means moving the router closer to the IoTaWatt or connecting a bridge appliance to relay the signal. I do that for a system that is in an outbuilding and it makes a huge difference.

  2. Change your bulk send parameter to something like 6 to reduce the number of transactions to Emoncms.

  3. Get a local instance of Emoncms by using a Raspberry Pi or other local platform. Since you have the IoTaWatt to measure power, you don’t need to buy an Emonpi, you can just get a Pi 3 and download the SDcard image from the OEM site.

The memory problems may go away in time as the new core with LwIP-2 matures, but aside from the entries in the log, restarting is a pretty low impact way to avoid more serious problems if the heap runs out. It literally takes a few seconds and you get a fresh start. For the record though, test systems here have run for from a week to ten days without incident and without losing any head at all. So I’m curious to see how this works out.

Thanks for the detailed clarifications.
Yes I know that my Iotawatts are located relatively long distance from my WiFi router. However I have three Iotawatts in the same room, installed side by side. Other Iotawatts do not have this same problem.

  1. But Yes, I will try to move router closer to Iotawatts, but it requires some cable modification. Or maybe I’ll install another WiFi AP to same room with Iotawatts.
  2. Let’s try also this.
  3. I have local Pi3 and local emoncms up and running to get data from old emonTX installation. But I like emoncms.org approach so I can get access to my data from everywhere. Using local emoncms it is more complicated. I do not want to modify my firewall or use dynDNS.

I’d be interested in seeing the message logs from the other two. There may be some significant difference. If they show a much better RSSI indication, then it would make sense to determine the cause of that.