We were noticing some strange history on tags from MQTT Engine whenever we rebooted the whole server or just the MQTT Engine. Some tags were falsely logging an arbitrary value from their past during the time between bootup until the SparkPlug nodes reconnected and provided the correct value.
After a bit of investigating and scratching our heads, we stumbled on the fact that those tags with the weird history also always had a configuration property named ‘value’ containing the exact value that was being falsely logged into the history. You could see it either by doing “Edit (raw)” in the designer or via getConfiguration(). We’ve never intentionally set a property named ‘value’, but we do have several scripts that walk through SparkPlug tags and ensure a certain configuration by doing a getConfiguration(), modifying it, and pushing it back in with configure().
Most of our tags don’t have a property named ‘value’ in their configuration. The best we can figure is that under unknown circumstances (maybe including running older versions of Ignition) a call to getConfiguration() included the tag’s current value as a property accidentally. And then our script happily wrote that back into place which lodged it there forever.
Our workaround to clean things up was to just update those same scripts which adjust the configuration to explicitly remove any property named ‘value’ if one is present.
But then we bumped into a new problem: if a tag has a current value from a node that is connected, and the tag configuration is modified such that the ‘value’ property is removed, then the current value from the node is flagged as invalid and forgotten! Even if the current value and the ‘value’ property didn’t have any relation to each other…
The value thankfully fixes itself the next time the SparkPlug node reports that tag, but our nodes don’t always report all tags on a regular basis. So our script (as a workaround on top of the workaround) now requests a rebirth from the node after re-configuring if it removed a ‘value’ property from any tags.
So, um…
My two inquiries to IA from this whole experience are:
- Under what circumstances might getConfiguration() include the current value as a property? Was this a bug in an old version or is this still possible?
- Is it a bug that a SparkPlug tag’s current value disappears if you reconfigure the tag and remove the ‘value’ property, even if it isn’t the current value?