Issue with ADAM 6717 and Context Filesystem Backup

Hello Node-RED Community,

I am working with an Advantech ADAM 6717 running Node-RED v1.2.2 for a water counting application. I've configured the context filesystem to store the water counter values and accumulate them throughout the month.

However, I've encountered an issue when the ADAM device loses power. Occasionally, the value of the variable saved in the filesystem is not cleared, but other times it is. I am conducting simulations to determine if my backup strategy is effective, but this inconsistency is causing some concerns.

Has anyone experienced similar issues with context filesystem persistence on Node-RED, particularly in relation to power loss scenarios? Any insights or suggestions on how to ensure the reliability of data persistence would be greatly appreciated.

Welcome to the forum @williamsixta1.

By default, the context data is flushed to the file system every 30 seconds (if it has changed) and when node-red shuts down normally. If there is a power loss, so that node-red does not get the opportunity to flush the latest data, then you may lose up to 30 seconds of data. Could this explain the problem you are seeing? The interval can be reduced by adding the flushInterval to the settings in settings.js, so you might have something like
file: { module: 'localfilesystem', config: {flushInterval: '10'} }
Obviously the shorter the interval the more will be the overheads of writing to disc.

If you are seeing that the data may have lost more than 30 seconds of data then check that you always use context.set() (or global or flow as appropriate) when changing data, not some other method.

Reading your post again, though, you appear to be saying that the context gets cleared sometimes, have a look at the node-red startup log when this happens and post here what it shows. Copy/paste please, not screenshot.

Finally I would say is that node red 1.2.2 is old, the current version is 4.0.2. I don't know whether there have been any significant changes to context since then but if possible you should upgrade. The problem with running node-red in unusual devices is that it may not be possible to upgrade.

Hello Colin;

Thank you for your reply.

I have set the flushInterval to 10 seconds. If I simulate a power outage on the ADAM 6717, the information usually isn't lost during the first outage. However, if I perform a second outage a few minutes after the ADAM 6717 has restarted, the information is lost.

Unfortunately, the ADAM 6717 does not support updated versions of Node-RED, according to information provided by the manufacturer.

Below, I have copied the information I was able to obtain from the command line terminal when starting Node-RED. Is this information useful to you?

Welcome to Node-RED

26 Jul 12:44:23 - [info] Node-RED version: v1.2.2
26 Jul 12:44:23 - [info] Node.js version: v10.22.1
26 Jul 12:44:23 - [info] Linux 4.9.65-rt23-g7069a470d5 arm LE
26 Jul 12:44:34 - [info] Loading palette nodes
26 Jul 12:44:41 - [warn] [node-red-contrib-email] Node module cannot be loaded on this version. Requires: >=2.0.0
26 Jul 12:44:41 - [warn] [node-red-contrib-opcua] Node module cannot be loaded on this version. Requires: >=1.3.0
[adam6700]
=======httpNode=======
26 Jul 12:45:29 - [info] Dashboard version 2.23.4 started at /ui
26 Jul 12:45:36 - [warn] ------------------------------------------------------
26 Jul 12:45:36 - [warn] [node-red-node-email/email] Error: Cannot find module 'node:buffer'
26 Jul 12:45:36 - [warn] [node-red-node-ui-table/ui_table] Type already registered
26 Jul 12:45:36 - [warn] [node-red-contrib-ui-artless-gauge/ui-value-trail] Type already registered
26 Jul 12:45:36 - [warn] ------------------------------------------------------
26 Jul 12:45:37 - [info] Settings file : /home/root/.node-red/settings.js
26 Jul 12:45:37 - [info] HTTP Static : /home/root/.node-red
26 Jul 12:45:37 - [info] Context store : 'memoryOnly' [module=memory]
26 Jul 12:45:37 - [info] Context store : 'file' [module=localfilesystem]
adam67c1

lib: serportio device is opened successfully.
lib: GetModuleName() = 'ADAM-6717', ok.
lib: The device is ADAM-6717.
globalFD=20
lib: FWDL_ReadMode - *o_mode=0x0 ok.
lib: GetWDTTimeout() => *timeout = 0
wdt=0
GetAdamDevType(): => adamio.Adv6700IO_API.GetModuleName.async() ...
lib: GetModuleName() = 'ADAM-6717', ok.
ADAM-6717
Device type is ADAM-6717
{ moduleType: 'ADAM-6717',
nDI: 5,
nDO: 4,
nAI: 8,
nAO: 0,
nCTR: 0,
nLen: 2,
nRFID: 0,
isPureDI: 1,
isPureDO: 1,
isSupBurnOut: 0 }
ConfigModuleAttrib(): => MyGetConfig() ...
26 Jul 12:45:38 - [info] User directory : /home/root/.node-red
26 Jul 12:45:38 - [warn] Projects disabled : editorTheme.projects.enabled=false
26 Jul 12:45:38 - [info] Flows file : /home/root/.node-red/flows_adam67c1.json
--- Fetch the I/O configuration ---
26 Jul 12:45:39 - [error] Unable to listen on https://127.0.0.1:1880/
26 Jul 12:45:39 - [error] Error: port in use
root@adam67c1:~# client_loop: send disconnect: Connection reset

By simulating, do you mean that you disconnect the power?

As you can see from the log you have problems with several of the nodes you have installed. Some are not compatible with your version of node red. When it says 'type already registered' that means that you have installed two similar nodes that conflict with each other.

The error at the end saying the port is already in use means that node red is already running. What you need to do is get the log from the startup where it fails, but I would first sort all the errors that are in the log and see if that helps.

In that case then personally I would run node red in a different device. You will continually run into such problems with such old versions of node-red and nodejs. Run node-red in a general purpose device which allows upgrading when required.

Dear Colin,

Thank you for the information. Here is what I have done and the results I have obtained:

What I have done:

  1. Thinking about the software part, I reinstalled the image and firmware on the ADAM 6717. After this, I continued to encounter the same errors.
  2. I noticed that by disconnecting the function that handles the pulse counter from the "change" node that updates my variable in the filesystem, there is no loss of information after turning the ADAM off and on. I assume that at some point, the Node-RED function either "writes" or "removes" the information from the filesystem variable.

I know that using an UPS could resolve the issue by providing backup power during outages. However, I would like to understand better what might be causing this behavior. Do you have any advice or insights on what might be happening? This will help me gain a deeper understanding of how Node-RED functions.

Do you mean that you made it so that the value in context does not change? If the power down is causing a corruption then I am not surprised that it does not get corrupted if it never changes.

What exactly happens to the value in context when you it fails?
Have you got something in the flow that initialises the value to zero? Are you sure that it is not that code running on startup that is clearing it?

Hello Colin;

I have gotten a new firmware version for the ADAM - 6717 with a new NodeRED version as well. I am going to try it and let you know the final results.

Best regards,

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.