Functions and Variables Disappearing

I have 5 Xenons with Ethernet, not using mesh, running on a customer network. At times the Xenons will lose their functions and variables. They can be running for hours without losing access to the functions and variables. I can still ping the Xenon, see events, and get the vitals (via the console) but the console says there are no functions and variables. If I wait long enough (5 minutes to a couple of hours) they will reappear. The same behavior exists on both OS 1.4.4 and 1.5.0-rc.1.

If I do a GET request to{deviceId} all of the info comes back correct except for “variables”:{},“functions”:{} Eventually they will return the correct values without power cycling or any other event.

What would be causing this to happen?

I have the same code running on dozens of other networks and 50+ Xenons and have yet to see this issue.

Make sure you declare then early in the setup, preferably first thing.

@Moors7 I am, the only thing before declaring them are 4 pinMode’s and 3 digitalWrite. Also, I see them when I power the Xenon on, but after some time usually 30-90 minutes they disappear and reappear as described above.

I would suggest running SerialLogHandler() to a PC where you can store the log output with time and also monitor the console events. It would be interesting to know what is happening when you lose the cloud connection. Clearly the recovery is not happening. In 1.4.4 this was a problem and the workaround was to reset if there was no cloud connection for a period (60 seconds say). With 1.5.0-rc.1 I haven’t noticed this problem occur although the devices go offline more often than expected for an ethernet connection.

The issue pops up when the describe message from the device does not make it through to our cloud.

Our engineering team is fully aligned behind the issue and the next two engineering sprints are devoted to solving it from the ground up.

The expected release date for the device side fixes is with DeviceOS 1.6 that is tentatively scheduled for the end of March. Cloud side fixes will be going out as they are tested and validated.

A few incidences can be fixed by running your code in SYSTEM_MODE(SEMI_AUTOMATIC); and calling Particle.connect() at the end of Setup(), after all the Particle Variables/Functions have been declared.

There is a temporary fix that should work in some cases:
Redeclaring a dummy with a different type variable (double instead of int for example) Particle.variable and then toggling Particle.connect() will cause the device service to request a new describe message. This has been tested on DeviceOS 1.4.4 and results are promising.

Thanks for the two fix instances. The first

helped my firmware on a Xenon in a mesh network with Argon gateway. The Xenon setup() originally used SYSTEM_MODE(AUTOMATIC) while not using SYSTEM_THREAD(ENABLED).

Was running ok with DeviceOS 1.5.0-rc.1 but after installing 1.5.0-rc.2 had issues with Particle.function(s) and Particle.variable(s) ghosting and plenty of disconnects from cloud.

Worked fine with no disconnects or disappearing cloud functions/variables once I changed setup() to use SYSTEM_MODE(SEMI_AUTOMATIC) and added the following statements to the end of setup():

waitFor(Particle.connected, 1000);

The above lines, in some fashion, were already in the loop() so reconnection could take place in the case of disconnection.