Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preventing Node-RED Application Exit on PLC Connection Failure #4703

Closed
ryanhaosun opened this issue May 15, 2024 · 2 comments
Closed

Preventing Node-RED Application Exit on PLC Connection Failure #4703

ryanhaosun opened this issue May 15, 2024 · 2 comments

Comments

@ryanhaosun
Copy link

Current Behavior

Problem Description:

In one of my Node-RED flows, I'm utilizing the node-red-contrib-s7 node to connect to a PLC. However, when the PLC goes offline or experiences an error, despite multiple reconnection attempts, the Node-RED application exits. Even though other flows are functioning normally, the entire Node-RED application shuts down. The error message received is as follows:

kotlin
Copy code
[red] Uncaught Exception:
14 May 09:13:35 - [error] Error: read ECONNRESET
at TCP.onStreamRead (internal/stream_base_commons.js:209:20)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! node-red-docker@2.1.4 start: node $NODE_OPTIONS node_modules/node-red/red.js $FLOWS "--userDir" "/data"
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the node-red-docker@2.1.4 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! /data/.npm/_logs/2024-05-14T09_13_35_060Z-debug.log
Is there a solution to prevent Node-RED from exiting in this scenario, even if the PLC connection is lost?

Expected Behavior

No response

Steps To Reproduce

No response

Example flow

paste your flow here

Environment

  • Node-RED version:
  • Node.js version:
  • npm version:
  • Platform/OS:
  • Browser:
@knolleary
Copy link
Member

Hi

The only practical fix is for the S7 node to handle it's errors properly. That isn't something the core of Node-RED can do for it.

Uncaught exceptions like this could come from anywhere and the recommended course of action (from node.js) is to restart the runtime as you have no idea what state it is in.

I recommend reporting this against the S7 nodes and see if they are able to provide a fix.

@knolleary
Copy link
Member

Closing as this is an S7 specific issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants