# Node-RED crash when connection to PLC drops

**URL:** <https://discourse.nodered.org/t/node-red-crash-when-connection-to-plc-drops/54918>\
**Category:** Industrial\
**Created:** [9 December 2021 09:46 UTC](https://discourse.nodered.org/t/node-red-crash-when-connection-to-plc-drops/54918 "2021-12-09T09:46:26Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![angrj](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/angrj/32/39835_2.png) [@angrj](https://discourse.nodered.org/u/angrj)\
**Post date:** [9 December 2021 09:46 UTC](https://discourse.nodered.org/t/node-red-crash-when-connection-to-plc-drops/54918/1 "2021-12-09T09:46:26Z")

</div>

Hello to all,  
I have a problem with Node-RED:  
continuously communicates with PLCs using node-red-contrib-s7, it works well but sometimes i get the following error:

`Error: read ECONNRESET at TCP.onStreamRead (node: internal / stream_base_commons: 211: 20)`

I noticed that the problem occurs when the connection with a PLC is missing for more than a few minutes.

This error stops Node-RED.

Here is last part of the logs:

```auto
7 Apr 11:30:39 - [error] [s7 endpoint:PLC - Pozzi Vasca Vecchia] Error: Timeout connecting to the transport
7 Apr 11:30:40 - [error] [s7 endpoint:PLC - Pozzi Vasca Nuova] Error: Timeout connecting to the transport
7 Apr 11:30:54 - [error] [s7 endpoint:PLC - Pozzi Vasca Vecchia] Error: Timeout connecting to the transport
7 Apr 11:30:55 - [error] [s7 endpoint:PLC - Pozzi Vasca Nuova] Error: Timeout connecting to the transport
7 Apr 11:31:10 - [error] [s7 endpoint:PLC - Pozzi Vasca Nuova] Error: Timeout connecting to the transport
7 Apr 11:31:13 - [red] Uncaught Exception:
7 Apr 11:31:13 - Error: read ECONNRESET
at TCP.onStreamRead (internal/stream_base_commons.js:209:20)

```

I already asked on the github's node package but i can't get an answer.

---

<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:** [9 December 2021 10:57 UTC](https://discourse.nodered.org/t/node-red-crash-when-connection-to-plc-drops/54918/2 "2021-12-09T10:57:13Z")

</div>

Unfortunately, this is something the node (or dependency) author needs to fix. As the author hasn't responded in 8 months your options are limited. You could fork the nodes in question and apply the fix yourself.

---

<div class="post-metadata">

**Author:** ![aderici](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/aderici/32/37279_2.png) [@aderici](https://discourse.nodered.org/u/aderici)\
**Post date:** [9 December 2021 15:18 UTC](https://discourse.nodered.org/t/node-red-crash-when-connection-to-plc-drops/54918/3 "2021-12-09T15:18:25Z")

</div>

I had a similar issue with mqtt connection through a custom azure iot hub node, had to switched to http instead of mqtt. Error sounded very low level so i thought it was a node error instead of a custom package one. But what i noticed was, node red was not able to catch and handle them, not sure if this is even possible though

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [9 December 2021 16:31 UTC](https://discourse.nodered.org/t/node-red-crash-when-connection-to-plc-drops/54918/4 "2021-12-09T16:31:05Z")

</div>

> [@aderici](#):
>
> node red was not able to catch and handle them

The node should catch and handle exceptions. Node red should not have to. Only exceptions that prevent node-red from continuing should get back up to node-red itself (such as out of memory).

---

<div class="post-metadata">

**Author:** ![hardillb](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hardillb/32/12373_2.png) [@hardillb](https://discourse.nodered.org/u/hardillb)\
**Post date:** [9 December 2021 16:46 UTC](https://discourse.nodered.org/t/node-red-crash-when-connection-to-plc-drops/54918/5 "2021-12-09T16:46:06Z")

</div>

Node-RED had no way of knowing what state a node will be in after an uncaught exception, it may not be possible to carry on safely, so the best option is to exit

---

<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:** [7 February 2022 16:46 UTC](https://discourse.nodered.org/t/node-red-crash-when-connection-to-plc-drops/54918/6 "2022-02-07T16:46:34Z")

</div>

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