Electron code crashing?

@Horganic: what SruffR says in indeed true. I had experienced this with my initial development on a Core, and found the limits of RAM under which heap framentation would not occur. In short, I wanted a buffer of 100 strings but could only get 40 to work reliably on Core. However, Photon and Electron have a LOT more RAM and my 100 string requirement can be met without experiencing heap framentation.

This issue is NOT heap framentation. It has occurred twice before, both times over a month ago. The first time that it happened, I was able to remotely reset the device by flashing the firmware again OTA. When it happened again, I decided to wait until I could access the site and when I did, I found that the Electron was breathing cyan and that my firmware was running just fine. So heap framentation has nothing to do with this issue, but it is important to know about of course. I pressed RESET and the Electron worked just fine – until it happened again today, that is.

My co-developer and I have 7 systems running with Photon (all for a lot longer than with the Electron) and have never seen this problem (albeit the Photons occasionally reset themselves for no apparent reasons, but at least they recover and communicate). So this is an Electron specific issue, IMHO.

Given these facts, there must be some issue with either the Particle system firmware or the 3G module on the Electron. The System firmware just isn’t getting the cloud requests for variable data or function execution. Something in the state machine that keeps tabs on could communication must get confused for some reason, but here I am into an area of pure speculation. The point here is that people who are using Electrons sitting on their bench can just press RESET and recover, but a remote installation at a customer site is not so forgiving.

In order to get this accomplished testing the most recent system and reporting back about the outcome would help Particle to know if added "fixes" did solve these issues already.

@BobG Yea the Watchdog feature may not help on this one but it would help if your code ever hangs so it’s not a bad idea even though it has not locked up on you just yet.

If your loosing cloud connectivity then you could just setup a Particle.Publish event every 12 hours or so and then subscribe to that event and have your code preform a System.reset() if it does not receive a response from the Particle.Publish that you sent out.

This way if you loose cloud connectivity you will not receive the event that you are subscribed to and this will cause the Electron to do a System.reset after you save your last 100 recorded entries into battery backed up RAM.

That should solve your problem.

I know there had been issues with some Webhook’s that stopped responding for no reason in the past and recently but David has put a fix that catches when this happens and fixes it for you.

What do you think?

ALL: I tried accessing the Electron again this morning, and it is working. The Electron did seem to eventually connect back to the cloud! I had tried this for about an hour last night, so it took longer than one hour but did reconnect in less than 9 hours. This is good to know, albeit I’d like to understand more about what it did behing the scenes to make this happen.

@RWB: the publish and subscribe is a good idea, albeit it increases the data charges. Note above – the reconnect, which is supposed to happen every 23 minutes, did seem to ultimately reconnect but it took more than 23 minutes for this to happen.

Remember there was a nationwide cellular issue last night where all electrons could not connect to the cellular network and this was fixed around 2am eastern time. That may be why it reconnected so you can’t rely on that happening to fix it next time.

@RWB: I did not know this! What happened? Was it a Particle Cloud issue or a cellular network issue? Either way, this seems to support my theory that these issues of not being able to access the Electron from the cloud are not issues with hardware or firmware on the Electron, but rather cloud/communication related. If so, issuing a System.reset() is unlikely to correct the problem; albeit it might speed up reconnection of the Electron to the cloud after the cloud/communication issue is resolved.

It was a cellular provider issue that has never happened before and should rarley or never happen again.

I think calling a System.reset(); should solve the issues you have been experiencing since going out the site all you could do is manually hit the reset button anyway. This would save you from the trip.