Node-red-sontrib-s7 ECONNREST error stop node-red

Hi, till now my flow has worked as expected without problem. Now, it's a couple of weeks I'm encountering this problem and I've not been able to solve it.
For what I've understood the problem is related to node-red-sontrib-s7 I use to reach a PLC via LAN node-red-contrib-s7 (node) - Node-RED
Until now even if the PLC was offline for a while, nothing happened, i just stopped receiving data till the PLC was back online again.
Now for some reason I'm starting have this problem: after a couple of minutes that node-red started, if the PLC is off line then node-red stops working with this log:

30 Jun 10:20:08 - [trace] [flow:84796f65f4434a57]  53806954b9c1899e | change       |
30 Jun 10:20:08 - [trace] [flow:84796f65f4434a57] ------------------|--------------|-----------------
30 Jun 10:20:08 - [trace] runtime event: {"id":"runtime-state","payload":{"state":"start","deploy":true},"retain":true}
30 Jun 10:20:08 - [info] Started modified nodes
30 Jun 10:20:08 - [trace] runtime event: {"id":"runtime-deploy","payload":{"revision":"93d550ceef5199182f4b78793fade258"},"retain":true}
30 Jun 10:20:48 - [error] [s7 endpoint:SCADA] Error: Request timeout
30 Jun 10:21:03 - [error] [s7 endpoint:SCADA] Error: Timeout connecting to the transport
30 Jun 10:21:18 - [error] [s7 endpoint:SCADA] Error: Timeout connecting to the transport
30 Jun 10:21:33 - [error] [s7 endpoint:SCADA] Error: Timeout connecting to the transport
30 Jun 10:21:41 - [error] [s7 endpoint:SCADA] Error: Request timeout
30 Jun 10:21:56 - [error] [s7 endpoint:SCADA] Error: Timeout connecting to the transport
30 Jun 10:22:11 - [error] [s7 endpoint:SCADA] Error: Timeout connecting to the transport
30 Jun 10:22:29 - [red] Uncaught Exception:
30 Jun 10:22:29 - [error] Error: read ECONNRESET
    at TCP.onStreamRead (node:internal/stream_base_commons:217:20)
nodered.service: Main process exited, code=exited, status=1/FAILURE

Now I would like to catch this error and properly handle it. I've tried several approch without success.This is what I got on the debug sidebar


I have even tried to just ignore this error by simply putting this code within the function node following the catch node. But nothing, node-red get continuosly stopped.

if (msg.error.message.includes('ECONNRESET')) return [null];

Thanks to all

See the numerous reports of this here: Issues · st-one-io/node-red-contrib-s7 · GitHub and in particular this unanswered one: checkbox for suppressing "Error: connect EHOSTUNREACH" in debug sidebar of NodeRed · Issue #116 · st-one-io/node-red-contrib-s7 · GitHub

Node-RED does not handle exceptions originating in async code (and node application should not attempt to either as good practice) the issue is in that node and you should raise or add detail to one of the existing issues.

Yes thanks, but in the meantime I would like to find a work-around to make node-red not stopping continuously.
In this post I see a suggestion that I had in mind, too "One solution would be for you to disable the endpoint when the PLC is not in operation". Is that possibile? How can I do this. For what I know the only possibility that exist in order to change from enable/disable node is make this change and redeploy the node. Does it exist an alternative solution?

Anything is possible, but you will need to get your hands dirty.

you could fork the code, make the necessary changes then install your fork.

How to fork a repository

How to install your fork directly from GitHub

I dont think so (i've not used that node for a few years)

Or you could just use GitHub - plcpeople/nodeS7: Node.JS library for communication to Siemens S7 PLCs and handle exceptions yourself

you can find more info by searching nodes7 in forum

Thanks so much for the support.

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