Agent repeatedly restarting while device powered off

In my log I noticed a series of messages indicating the agent associated with my device has restarted several times overnight, while the device was powered off. The message is a result of a server.log(“agent started”) call at the beginning of my agent code.
If the agent restarted, it means it also has stopped running several times, although this is obviously not logged. I wonder what is behind this repeated stopping/restarting of the agent. Is this normal behaviour and expected to happen during normal operation, also while the device is powered on?

Here’s a snippet from my log:
Mon May 13 2013 19:06:20 GMT+0800 (China Standard Time): Power state: online=>offline
Tue May 14 2013 03:08:01 GMT+0800 (China Standard Time): agent started
Tue May 14 2013 05:16:39 GMT+0800 (China Standard Time): agent started
Tue May 14 2013 05:17:33 GMT+0800 (China Standard Time): agent started
Tue May 14 2013 05:18:33 GMT+0800 (China Standard Time): agent started
Tue May 14 2013 05:19:48 GMT+0800 (China Standard Time): agent started
Tue May 14 2013 05:20:28 GMT+0800 (China Standard Time): agent started
Tue May 14 2013 05:24:10 GMT+0800 (China Standard Time): agent started

Agents are still in beta; the reason they are still there is that we’re working on getting the bugs out of them. Still got some left, it seems :slight_smile:

this is good practice but would still be interesting to have an idea on when you expect it to be stable enough for production. We’re waiting to put our ‘wifi enabled’ product feature in the market until all is stable and well.

Devices with agents would recover seamlessly even after the issues above.

However, agents can and will get shut down - both with and without advance programmatic notice - eg if a server fails. The agent code needs to be able to deal with this, which is why persistent storage is coming. Agents should be written to automatically recover in these circumstances, and re-establish outbound connections to services they rely on, etc.