IMD SolutionComputing LibraryShop main store

Troubleshooting

Fix Node-RED InfluxDB write errors after a network outage

Edge computing and IIoT Published 6 min read

Short answer

When InfluxDB output nodes throw ECONNRESET after a network outage, Node-RED is usually still holding dead TCP client sessions. Confirm the database is reachable from the Node-RED host, then use the Deploy menu's flow-restart option to rebuild every connection while the runtime stays up.

On this page
  1. Why writes keep resetting after the link is back
  2. Check the database path before touching the runtime
  3. Restart the flows from the Deploy menu
  4. What waiting for the window costs: 10 machines at one record per second
  5. If the flow restart does not clear the errors
  6. Questions asked

You can usually clear repeated Error: read ECONNRESET on your InfluxDB output nodes without stopping Node-RED: verify the database is reachable from the Node-RED host, then open the drop-down menu on the Deploy button and use the flow-restart option. That stops and restarts the flow nodes while the runtime keeps running, rebuilding every database connection the flows hold. Restarting flows interrupts processing for seconds; waiting for a maintenance window while no writes land can cost tens of thousands of records, so the short interruption is almost always the cheaper choice. Work through the checks below in order, because restarting against an unresolved network fault just puts you back where you started.

ECONNRESET means the TCP connection was abruptly closed by the remote server or a device between you and it. It is a transport-level event, not an InfluxDB message, and it does not identify who sent the reset.

The reason it persists after the network looks healthy is connection reuse. Database clients keep connections open so the next write can skip the handshake. A network outage invalidates the established session while the client still holds state for it. Restoring the physical link restores reachability; it does not restore the old TCP session. The next write goes out on a dead socket and comes back as a reset, over and over.

This is also why the error shows up on many InfluxDB nodes at once rather than one: nodes pointed at the same endpoint share the failure mode. Multiple nodes failing together points at the shared endpoint, the shared network path, or stale client state, not at a fault in each node individually.

Check the database path before touching the runtime #

Work down this list from the Node-RED host itself. A test from your workstation does not exercise the same route or the same name resolution:

  • Resolve the database hostname configured in the output nodes, from the Node-RED host, and compare the answer with the intended database address.
  • From that same host, test the configured database port to confirm the listener answers. For an InfluxDB target the default is TCP port 8086, but always test the port your nodes actually have configured.
  • Check the database service state and its logs at the timestamps of the write failures, especially if the database shares the host or rebooted during the outage.
  • Confirm the MQTT input is still delivering messages by observing a debug node wired just before the write and showing msg.payload, so you know the inbound path and the outbound path are separate problems.
  • If traffic crosses a firewall or NAT device, check its idle-connection handling; devices with idle timeouts drop sessions that sit between sparse writes.

If every check passes, the fault is stale client state in Node-RED and the flow restart in the next section is the fix. If any check fails, correct the infrastructure first; otherwise the flow restart reconnects into the same broken path.

Restart the flows from the Deploy menu #

Recent Node-RED releases expose a flow-restart command at the bottom of the drop-down menu on the Deploy button. It leaves the Node-RED runtime running and stops and restarts the flow nodes, which tears down and rebuilds their connections, including the ones to the database. Treat it as a processing interruption, not as a surgical reconnect of one node: agree the moment with operations, and know that messages arriving while nodes are stopped are not retained unless you have set up buffering such as the MQTT store and forward backfill after a connection outage approach.

Then:

  1. Record the exact error text, the affected nodes, and the installed Node-RED and database-output package versions, so you can reproduce or report the fault later.
  2. Confirm the database path checks from the previous section all pass.
  3. Trigger the flow restart from the Deploy menu and make no unrelated configuration edits in the same deploy.
  4. Watch the node status and the runtime log as the connections reopen.
  5. Send one controlled test message through the path and confirm the value lands in the database with the right tag and timestamp; the same checks used to troubleshoot missing data in a Node-RED InfluxDB Grafana stack will confirm the write end to end.

What waiting for the window costs: 10 machines at one record per second #

Inputs. Ten machines, each publishing one record per second (an illustrative typical rate for this kind of line monitoring; substitute your own machine count and rate). Writes have been failing since the link returned, so nothing is currently being stored, which is the situation described here. The next approved window is four hours away (illustrative).

Rule. Records that never reach the database = machine count × records per machine per second × seconds of delay.

Arithmetic. 10 machines × 1 record/(machine·s) = 10 records/s. Over one hour: 10 records/s × 3,600 s = 36,000 records/h. Over the four-hour wait: 36,000 records/h × 4 h = 144,000 records.

Result. Waiting until the window costs 144,000 records that were never written, while a flow restart stops node processing for seconds.

Decision. At this rate, every hour of delay costs 36,000 records; any time writes are failing outright rather than being buffered, take the seconds-long flow interruption now instead of the hours-long wait. Above roughly one machine publishing once per second, the arithmetic only gets worse.

If the flow restart does not clear the errors #

If resets continue after a flow restart and the path checks are clean, keep the diagnostics you collected and schedule a runtime restart, which additionally rebuilds the process-level client resources. That needs a shorter and smaller interruption than the whole-system restart, and it isolates the fault better than rebooting host, runtime, and database together, which clears the stale session but masks the cause.

If you want to see the reset happen, capture traffic on the Node-RED host during a controlled write. The trace distinguishes a request that never reaches the destination from a connection that is established and then reset, and correlating the reset's direction with the database host's logs assigns the cause properly instead of trusting the application error alone.

One more trap: the same ECONNRESET text appears in Node-RED when other protocols lose sessions, for example on Siemens PLC links, where the causes and fixes are different; the write-up of the Node-RED ECONNRESET error on S7-1200 and S7-1500 PLCs covers that case. Do not carry a fix from one protocol into the database path.

Finally, reduce the recurrence. If your write rate is sparse, idle sessions are vulnerable to firewall and NAT idle timeouts, and periodic traffic or TCP keepalives keep the path from being dropped between writes. If the outage itself is the recurring problem, the broker-side buffering pattern above holds the records through the gap, and a properly sized host for the Node-RED InfluxDB Grafana stack keeps recovery times short when a restart is unavoidable.

Questions asked

Does ECONNRESET mean InfluxDB rejected my write?

No. ECONNRESET is a TCP-level reset reported on the socket, not a database validation message, and it does not tell you which side sent the reset. The database host, a firewall, or a stale half-dead session can all produce it. A genuine InfluxDB rejection comes back as an HTTP status or a client error that names the request and the reason, not as a socket reset.

Is there a reconnect setting on the InfluxDB output node?

There is no documented reconnect option in the output node's configuration to enable. The expectation is that the next write attempt opens a fresh connection after a failure. In practice, a session that died during an outage can keep failing on every write until the flows are restarted, which is exactly why the flow-restart option is the reliable recovery path here.

Are the records from the failed interval recoverable afterwards?

Writes that failed with a reset were never accepted by the database, so they are gone unless the data still exists somewhere upstream. Messages Node-RED already consumed and failed to write are unrecoverable. Messages still held at the MQTT broker for a persistent session can arrive after recovery. Buffering has to be planned before the outage, not added after it.

Why did restarting the whole system fix it for other people?

Restarting the host, Node-RED, and the database together tears down and rebuilds every TCP session and endpoint at once, so the stale client state is cleared along with anything else that was wrong. It does work, but it changes everything simultaneously, so a success there tells you nothing about which component actually caused the resets.

Should I replace the database hostname with an IP address?

Only if name resolution is actually failing. Resolve the configured hostname from the Node-RED host and compare the answer with the database address first. Swapping in an IP address is a workaround for a resolver fault and can hide it. It does nothing for the common post-outage case, which is a stale TCP session being reset on write.

Keep reading

  • How-to

    Build multidimensional arrays in Node-RED for InfluxDB writes

    Cache each subscription's last value per point, re-emit it on a 100 ms inject tick, batch 10 samples per point and join them into one multidimensional array, then format line protocol in a single function node so one influxdb out node writes the whole batch. Ten points at a 100 ms tick become one 100-line write per second; the demonstrated flow neared Node-RED's limit at 80 points.

    Edge computing and IIoT

  • How-to

    How to query InfluxDB over MQTT with a bridge flow

    InfluxDB does not answer queries over MQTT: it serves them over its HTTP API. Put a bridge on the edge PC — a Node-RED flow subscribed to a request topic — that maps a validated, bounded request to a query against the bucket and publishes the result to a separate response topic, so request and reply never loop.

    Edge computing and IIoT

  • Troubleshooting

    Troubleshoot missing data in a Node-RED InfluxDB Grafana stack

    Work the chain in order: acquisition into Node-RED, the InfluxDB service and its storage mount, the write settings, then the Grafana query. In a 2.x stack most empty panels trace to a wrong token, bucket, URL or a controller clock that stamps points outside the panel's time range.

    Edge computing and IIoT