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

**URL:** <https://discourse.nodered.org/t/node-red-sontrib-s7-econnrest-error-stop-node-red/89104>\
**Category:** General\
**Created:** [30 June 2024 08:57 UTC](https://discourse.nodered.org/t/node-red-sontrib-s7-econnrest-error-stop-node-red/89104 "2024-06-30T08:57:11Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Lupin\_III](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/lupin_iii/32/67650_2.png) [@Lupin\_III](https://discourse.nodered.org/u/Lupin_III)\
**Post date:** [30 June 2024 08:57 UTC](https://discourse.nodered.org/t/node-red-sontrib-s7-econnrest-error-stop-node-red/89104/1 "2024-06-30T08:57:11Z")

</div>

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](https://flows.nodered.org/node/node-red-contrib-s7)  
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:

```auto
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

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/3/a/3a2ccf38dce8b14f1ec70768f773c90e6ee7dccc.png)  
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.

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

```

Thanks to all

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [30 June 2024 09:27 UTC](https://discourse.nodered.org/t/node-red-sontrib-s7-econnrest-error-stop-node-red/89104/2 "2024-06-30T09:27:34Z")

</div>

See the numerous reports of this here: [Issues · st-one-io/node-red-contrib-s7 · GitHub](https://github.com/st-one-io/node-red-contrib-s7/issues?q=is%3Aissue+ECONNRESET) 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](https://github.com/st-one-io/node-red-contrib-s7/issues/116#issuecomment-2132947113)

> [@Lupin\_III](#):
>
> 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.

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.

---

<div class="post-metadata">

**Author:** ![Lupin\_III](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/lupin_iii/32/67650_2.png) [@Lupin\_III](https://discourse.nodered.org/u/Lupin_III)\
**Post date:** [30 June 2024 10:33 UTC](https://discourse.nodered.org/t/node-red-sontrib-s7-econnrest-error-stop-node-red/89104/3 "2024-06-30T10:33:59Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [30 June 2024 10:45 UTC](https://discourse.nodered.org/t/node-red-sontrib-s7-econnrest-error-stop-node-red/89104/4 "2024-06-30T10:45:37Z")

</div>

> [@Lupin\_III](#):
>
> 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?

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.

> [@Lupin\_III](#):
>
> How can I do this.

[How to fork a repository](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/fork-a-repo)

[How to install your fork directly from GitHub](https://discourse.nodered.org/t/how-to-install-node-from-github/55549/2)

> [@Lupin\_III](#):
>
> 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?

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

---

<div class="post-metadata">

**Author:** ![KarolisL](https://avatars.discourse-cdn.com/v4/letter/k/a4c791/32.png) [@KarolisL](https://discourse.nodered.org/u/KarolisL)\
**Post date:** [30 June 2024 21:23 UTC](https://discourse.nodered.org/t/node-red-sontrib-s7-econnrest-error-stop-node-red/89104/5 "2024-06-30T21:23:50Z")

</div>

Or you could just use [GitHub - plcpeople/nodeS7: Node.JS library for communication to Siemens S7 PLCs](https://github.com/plcpeople/nodeS7) and handle exceptions yourself

you can find more info by searching nodes7 in forum

---

<div class="post-metadata">

**Author:** ![Lupin\_III](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/lupin_iii/32/67650_2.png) [@Lupin\_III](https://discourse.nodered.org/u/Lupin_III)\
**Post date:** [2 July 2024 13:11 UTC](https://discourse.nodered.org/t/node-red-sontrib-s7-econnrest-error-stop-node-red/89104/6 "2024-07-02T13:11:32Z")

</div>

Thanks so much for the support.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [30 September 2024 13:11 UTC](https://discourse.nodered.org/t/node-red-sontrib-s7-econnrest-error-stop-node-red/89104/7 "2024-09-30T13:11:41Z")

</div>

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