william89731 / node-red-contrib-ssh-v3

node module for nodered
Apache License 2.0
9 stars 6 forks source link

SSH throw an error - Node Red Flow gonna restart after that #16

Open tmuellerchen opened 2 months ago

tmuellerchen commented 2 months ago

Hello :)

I use this node in one flow 6 times - it works very fine, but sometimes (I don't know what is the cause) it throw this error:

21 Apr 14:18:44 - [info] [ssh-v3:Japetus] Ssh client error in input. 21 Apr 14:18:44 - [info] [ssh-v3:Japetus] Error: (SSH) Channel open failure: open failed 21 Apr 14:18:44 - [info] [ssh-v3:Japetus] Error: error:00000000:lib(0):func(0):reason(0) 21 Apr 14:18:44 - [info] [ssh-v3:Japetus] Ssh client error in input. 21 Apr 14:18:44 - [red] Uncaught Exception: 21 Apr 14:18:44 - [error] Error: Unable to exec at Array. (/data/node_modules/ssh2/lib/client.js:1836:39) at onCHANNEL_CLOSE (/data/node_modules/ssh2/lib/utils.js:76:21) at ChannelManager.cleanup (/data/node_modules/ssh2/lib/utils.js:200:7) at Socket. (/data/node_modules/ssh2/lib/client.js:831:21) at Socket.emit (node:events:513:28) at TCP. (node:net:301:12)

and after that the flow (or maybe the complete docker container) restarts.

In my flow, it can be that the ssh node is triggered by a message and the ssh machine is down in this moment. maybe this is the problem (?)

lixaster commented 2 months ago

I have the similar issue as well.

It seems that when the SSH client fails to communicate, it triggers an error, leading to the restart of the Node-RED Docker container.

Is it possible to add exception handling so that even if the connection fails, it doesn't affect the running of Node-RED itself?

6 May 16:01:22 - [info] [ssh-v3:RedMi4X] Error: read ETIMEDOUT 6 May 16:01:22 - [error] [ssh-v3:RedMi4X] Error: read ETIMEDOUT 6 May 16:01:22 - [info] [ssh-v3:RedMi4X] Ssh client error in input. 6 May 16:01:22 - [red] Uncaught Exception: 6 May 16:01:22 - [error] Error: No response from server at Socket. (/data/node_modules/node-red-contrib-ssh-v3/node_modules/ssh2/lib/client.js:826:19) at Socket.emit (node:events:513:28) at TCP. (node:net:301:12)