IMD SolutionComputing LibraryShop main store

Troubleshooting

Node-RED Data Layer subscription crash on ctrlX CORE

Edge computing and IIoT Published 9 min read By IMD Solution engineering team

Short answer

Deploying a 60th Data Layer Subscribe node in Node-RED on ctrlX CORE v1.12 can crash and reboot the controller, discarding the unsaved flow edit. Stabilize production without a shutdown by moving excess tags to a Data Layer Request node polled on a 500 ms Inject interval with rising-edge detection. For a permanent fix, schedule a shutdown to upgrade system apps, the Node-RED app, and matching engineering tools together to v1.20 or later.

A laptop showing a node browser with a folder tree and the value of one selected tag, joined by a green Ethernet cable to a compact PLC on a DIN rail
On this page
  1. Confirm the subscription crash and audit the flow
  2. Stabilize production with Data Layer Request polling
  3. Worked example: sizing a polled tag group against request limits
  4. Plan the coordinated upgrade from v1.12 to v1.20 or later
  5. Decide when to keep Node-RED on the controller or offload it
  6. Questions asked

On a ctrlX CORE running v1.12 system apps, deploying a 60th ctrlx-datalayer-subscribe node in Node-RED can crash and reboot the controller, discarding the unsaved flow edit on restart. Do not keep retrying deploys on a live machine. To stabilize production without a shutdown, move the new tag—and enough low-priority status tags to regain headroom below the working ceiling—onto a Data Layer Request node polled on a 500 ms Inject interval with rising-edge detection for Boolean events. For the permanent fix, schedule a planned shutdown to upgrade ctrlX CORE system apps, the Node-RED app, and matching engineering tools together to v1.20 or later.

Confirm the subscription crash and audit the flow #

Before restructuring a production flow, verify that the crash tracks active subscription count rather than a malformed tag path. On legacy v1.12 controllers where 59 subscriptions operate reliably, deploying one additional ctrlx-datalayer-subscribe node forces a controller reboot, yet removing an existing subscription and adding the new address deploys cleanly.

Run these checks before editing further:

  • Verify the swap behavior: Confirm off-shift that deleting one existing Subscribe node allows the new address to deploy. That isolates the fault to total active subscriptions rather than a bad Data Layer path.
  • Audit installed versions: Record the AutomationCore System App build alongside the Node-RED app and node-red-contrib-ctrlx-automation package version. Per the Node-RED Flow Library documentation for node-red-contrib-ctrlx-automation, AutomationCore System App version 1.20.0 (XCR-V-0120 / Milestone 23.03) or newer is recommended for full subscription-property support and to prevent [404] Not Found errors.
  • Count ctrlx-config-subscription nodes: Check the Configuration Nodes sidebar in Node-RED. According to the node-red-contrib-ctrlx-automation reference manual, subscribed items sharing one ctrlx-config-subscription node run on a single server-side subscription thread; duplicate configuration nodes multiply server threads even at the same tag count.
  • Inspect server-side bounds and CPU load: Read datalayer/subscriptions/settings (backed by FlatBuffers schemas sub_settings.fbs and sub_properties.fbs, viewable under Settings -> Data Layer) to check active controller limits on sampling, publishing, and queue buffers. Monitor CPU load on framework/metrics/system/cpu-utilisation-percent, as shown in the node-red-contrib-ctrlx-automation examples guide.
  • Check logbook persistence: Enable a persistent logbook and capture a system report after a crash where supported. Older v1.12 builds may lack the persistent logbook option in the UI, so export the flow JSON before testing changes.

The 59-to-60 failure point on v1.12 is an observed operational crash threshold, not a vendor-published hard cap. Each ctrlx-datalayer-subscribe node runs over Server-Sent Events (SSE) rather than polling, adding server-side sampling, queue buffering (samplingInterval and publishInterval default to 1 s, and queueSize defaults to 10), and JSON stream parsing alongside other flow nodes such as SQL and HTTP clients. On a memory-constrained ARM controller such as a ctrlX CORE X3 with 2 GB RAM, stacking dozens of subscriptions on v1.12 system apps—paired with older package builds that lacked fixes for partially received JSON event streams—can crash the controller on deploy.

Stabilize production with Data Layer Request polling #

When production cannot stop for an upgrade, replace slow or newly added Subscribe nodes with polled Data Layer Request reads to stay safely below the crash ceiling.

  1. Export the working flow JSON: Save a backup from the Node-RED menu first, since a crash-reboot discards unsaved edits.
  2. Move non-critical tags to Data Layer Request (read): Replace excess Subscribe nodes with a Data Layer Request node configured to read each address. When related signals live under one branch, consolidate calls by reading a Data Layer node and its subnodes in Node-RED instead of issuing one request per tag.
  3. Drive reads from a repeating Inject node: Use a 500 ms interval for operator status bits and handshakes, or a slower period (2 s to 5 s) for temperatures and counters.
  4. Detect rising edges on Boolean triggers: Polled reads emit the current value every cycle rather than only on change, so add edge detection before SQL writes, HTTP requests, or counters.
  5. Keep overflow protection enabled: In the node-red-contrib-ctrlx-automation reference manual, Data Layer Request defaults to pendingWarnLevel at 50 pending requests (logging "Number of requests very high. There are already responses pending.") and pendingErrorLevel at 100 pending requests (dropping further incoming requests and raising an error for a Node-RED catch node). Wire a catch node to log drops rather than disabling the guard with 0 or an empty field.

Rising-edge detection for polled Boolean signals #

Place a Function node directly after the Data Layer Request node so steady true reads emit only on the false-to-true transition. Below, msg.payload, context.get, and context.set are documented Node-RED APIs; currentState, previousState, and lastEdgeState are illustrative local Boolean variables initialized to false:

// Illustrative local Boolean variables; initial stored state is false
const currentState = Boolean(msg.payload);
const previousState = Boolean(context.get("lastEdgeState") ?? false);

context.set("lastEdgeState", currentState);

if (currentState && !previousState) {
    msg.payload = true;
    return msg;
}

return null;

Prove the behavior with a Debug node before connecting downstream outputs by injecting five values in order (false, true, true, false, true): only the first and final true values should pass through, while the repeated true and both false inputs return nothing. Remember the basic polling constraint: any PLC pulse shorter than one poll cycle can rise and fall between scans unseen. Hold polled trigger bits high for at least 1 s, or latch them in the PLC until Node-RED writes a handshake reset.

Dynamic subscriptions as a second workaround #

Starting in node-red-contrib-ctrlx-automation v1.9.x, the ctrlx-datalayer-subscribe node supports runtime dynamic subscribe and unsubscribe commands, documented in the package's examples guide and release notes. For intermittent diagnostic screens or recipe-specific tags, dynamic subscription lets one flow switch monitored addresses on demand instead of holding dozens of static subscriptions open continuously. Confirm matching system app support first, because running dynamic subscription features against outdated system apps can return [404] Not Found errors.

Worked example: sizing a polled tag group against request limits #

Always verify poll burst drain time against the documented pending-request limits (pendingWarnLevel of 50 and pendingErrorLevel of 100) before loading many tags onto one Inject node. Take an illustrative example where you move 14 slow subscriptions plus 1 new tag (15 polled tags total, leaving 45 active subscriptions below the working ceiling) onto a single Data Layer Request node triggered every 0.5 s:

  • Incoming request rate: 15 requests / 0.5 s = 30 requests/s.
  • Healthy controller (illustrative 25 ms serialized response per request): One poll burst drains in 15 requests * 25 ms/request = 375 ms, leaving 500 ms - 375 ms = 125 ms of margin before the next tick. Peak pending count stays at 15, safely below the warning threshold.
  • Loaded controller (illustrative 50 ms serialized response per request): Service capacity falls to 1 request / 0.05 s = 20 requests/s, creating a net backlog growth of 30 requests/s - 20 requests/s = 10 requests/s.
  • Time to warning and drop thresholds: At 10 requests/s net growth, pending requests reach the warning threshold in 50 requests / 10 requests/s = 5 s and the drop threshold in 100 requests / 10 requests/s = 10 s, throwing a catchable error and discarding further requests.

The engineering decision follows directly from those numbers. If measured burst drain time approaches the poll period or logs pending-request warnings, never set pendingErrorLevel to 0. Instead, lengthen the Inject interval—1 s lowers the 15-tag rate to 15 requests/s and 2 s lowers it to 7.5 requests/s, both below the illustrative 20 requests/s loaded capacity—stagger reads across offset timers, or collapse scalar reads into one parent-branch request.

Plan the coordinated upgrade from v1.12 to v1.20 or later #

Polled reads buy time in production, but the permanent fix is upgrading the ctrlX CORE system apps and the Node-RED app together to v1.20 or later during a scheduled maintenance shutdown. Moving to AutomationCore System App 1.20.0 (XCR-V-0120) or newer with a matching node-red-contrib-ctrlx-automation package resolves the v1.12 subscription incompatibilities and brings package fixes for partial JSON event streams, read timeouts, pending-request limits, and automatic reconnection after reboots.

Total upgrade downtime is not a fixed constant—it varies with installed apps, drive firmware alignment, and scheduler checks—so time the full procedure on a bench or spare controller before setting a production outage window. Address each dependency below:

  • Take complete backups first: Archive the ctrlX CORE configuration and apps, back up the PLC project, and export the Node-RED flow JSON plus external database or HTTP credentials off-controller.
  • Upgrade system apps and Node-RED together: Do not mix v1.12 system apps with a newer Node-RED app or vice versa; keep the Node-RED app matched to the v1.20+ system app release.
  • Upgrade ctrlX WORKS and the PLC project: Opening or modifying the PLC project after upgrading the controller requires ctrlX WORKS v1.20 (or matching target release), and the PLC project should be updated to the corresponding version.
  • Match ctrlX DRIVE runtime on drive-integrated controllers: Confirm that the target ctrlX CORE system app version matches a compatible ctrlX DRIVE runtime version in the vendor release documentation before flashing.
  • Plan for scheduler resets: Carrying a v1.12 configuration forward to v1.20 can require resetting scheduler settings—for example, to resolve a Motion app stalling between Configuration and Running states on boot.
  • Verify full subscription load before handing back production: Re-enable all required Subscribe nodes, confirm clean deploys without [404] Not Found errors, and check framework/metrics/system/cpu-utilisation-percent under cycle load.

Decide when to keep Node-RED on the controller or offload it #

Subscription crashes also highlight a deployment boundary decision when running PLC logic and Node-RED on one ctrlX CORE: decide whether the IIoT flow belongs inside the PLC controller at all.

Deployment case Recommended path Operational trade-off
Live v1.12 controller cannot shut down yet Move excess or slow tags to Data Layer Request polling with rising-edge detection Keeps production running immediately; requires latched or long pulses
Moderate flow with a planned shutdown Upgrade ctrlX CORE system apps, Node-RED, and ctrlX WORKS together to v1.20+ Keeps a single-controller footprint; Node-RED still shares PLC RAM and reboot domain
Lossless or high-rate real-time sampling (samplingInterval set to 0) Shift real-time capture out of Node-RED to the ctrlX Telegraf app Built for deterministic real-time subscriptions without Node.js parsing overhead
Heavy IIoT workload (SQL writes, HTTP APIs, dashboards, or strict PLC isolation) Run node-red-contrib-ctrlx-automation remotely over HTTPS (port 443) on a cabinet edge host Isolates Node-RED crashes and heap growth from the PLC; adds an external host and network link

For deterministic, lossless real-time data capture rather than event-driven status integration, move acquisition to sampling real-time data with the ctrlX Telegraf app instead of pushing high-frequency streams through Node-RED.

When flows combine dozens of Data Layer tags with SQL databases, HTTP clients, and dashboards—and a Node-RED fault must never reboot the machine controller—move Node-RED off the PLC onto an industrial mini PC in the cabinet. The node-red-contrib-ctrlx-automation package connects remotely over HTTPS on port 443 with Bearer-token authentication (POST /identity-manager/api/v2/auth/token), separating flow deploys and Node.js memory management from the real-time core.

On a standalone embedded Linux edge host running Node-RED as a systemd service, constrain the Node.js V8 heap with node-red-pi --max-old-space-size=256 or Environment="NODE_OPTIONS=--max_old_space_size=256" in /lib/systemd/system/nodered.service, per the Node-RED Raspberry Pi startup documentation, and configure automatic service recovery as outlined in recovering Node-RED from memory-growth crashes with systemd. On a ctrlX CORE itself, Node-RED runs inside the controller's managed app environment rather than a user-edited systemd unit, so on-controller memory control relies on consolidating ctrlx-config-subscription nodes, trimming unused subscriptions, and keeping queueSize conservative.

Questions asked

How do queueBehaviour and deadBandValue reduce Data Layer subscription load?

Setting a positive deadBandValue filters out analog noise by publishing updates only when the absolute difference between the last captured value and the new value exceeds that threshold. Pairing a deadband with Discard Oldest queue behavior keeps the newest process state during brief bursts, whereas Discard Newest preserves early transition history for fault sequences. Together, these parameters lower event traffic across the subscription stream without removing monitored items.

Can an external client subscribe to multiple Data Layer nodes without Node-RED?

Yes. The ctrlX AUTOMATION SDK provides native multi-node Data Layer client subscriptions in C++, Python, .NET, and Node.js alongside a REST Server-Sent Events endpoint at automation/api/v2/events accepting comma-separated node paths and a publishIntervalMs query parameter. Clients authenticate with a Bearer token over HTTPS, letting a separate edge service monitor many addresses without running the Node-RED app on the controller.

What do errorInterval and keepaliveInterval control in a subscription configuration node?

In a ctrlx-config-subscription node, errorInterval sets how frequently subscription errors are reported or retried when a subscribed Data Layer path becomes unavailable, while keepaliveInterval sets how often an idle subscription sends a heartbeat so the stream stays verified when monitored values do not change. Configuring conservative intervals on quiet status groups prevents log floods and unnecessary heartbeat traffic across the event connection.

Can special characters in Data Layer paths or IPv6 addresses cause separate Node-RED failures?

Yes. Older builds of node-red-contrib-ctrlx-automation had separate defects with IPv6 addresses containing zone indices and with special characters such as a caret in axis acceleration paths. If a single newly added node fails while your total active subscription count sits well below sixty, check the target path syntax and connection address formatting and verify the installed package release before changing your subscription architecture.

Keep reading

  • How-to

    Running PLC logic and Node-RED on one ctrlX CORE

    Yes: one ctrlX CORE runs the PLC application and the Node-RED app at the same time, with the ctrlX Data Layer as the only bridge between them. Keep every time-critical machine decision in the PLC scan; Node-RED reads the published data and serves the dashboard. Prove the chain with one internal test value at each boundary before trusting a single displayed number.

    Edge computing and IIoT

  • Troubleshooting

    Why MQTT sensor data is missing in OPC UA on a ctrlX CORE

    MQTT reception and OPC UA exposure are separate layers: a subscription never creates a variable. Run a Data Layer provider app that registers one node per measurement, point Node-RED's Data Layer write at each registered address, and the ctrlX OPC UA server then exposes those nodes to clients.

    Edge computing and IIoT

  • Troubleshooting

    Node-RED reports device full when the edge PC card fills

    The deploy error means the filesystem behind Node-RED's user directory has no space left, not that the editor is broken. Read df -h to confirm, expand unused card space where the OS provides the option, then run du -h to find the writer — retained messages, logs or a database. Check load-side supply voltage before rewriting a card that also hangs at boot.

    Edge computing and IIoT

ctrlX CORE InfluxDB web UI 404 after app install