Deploy "Hangs" all of a sudden

Hi all,

I dont have a complicated node red deployment simple - installed on Ubuntu Server (latest version) with the latest version of node red.

I have three flows mostly read from MQTT and write into influx and all working well. I recently added a function node with a single if else JavaScript and all is working. However when I make a change add a node or change the code in the Function node and click deploy the screen dims/greys out like when its trying to deploy but then just hangs / stays there.

Checking with :

journalctl -x -f -u  nodered.service

Everything is still happening in the background as if nothing has changed but the web interface is greyed out and still "trying" to deploy. If I refresh the web page comes back up and of course the changes are lost.

Anyone know what this could be or what I can look for?

Do you mean when you make any change at all it fails to deploy?

If so then stop node red and start it again in a terminal. If you used the recommended install script you can use
node-red-stop
node-red-start
and then try the deploy. Post the full output from the console up to the failure.

If you run top while it is hung then is anything hogging the processor?

Thank you for the reply.

So to follow the steps

  1. I make any change (tested it with various changed on the dashboard) add a new node, link a node, change JScript in a Function node etc etc they relatively small changes, not creating massive flows and or code.
  2. I select Deploy for Modified nodes:
    NodeChanges

I tested - full deploy etc all the same result.

I checked to see if there are any hogs - doesn't seem like anything unusual:

PiStats

It is a RPi 4 with 8 Gigs ram etc etc (for reference).

If I Stop & Start it the first deploy is instant but after that goes back to the same outcome which is fustrating.

If I leave the the site in the greyed out "Deploying" for a period of time (it varies anything from 10mins to 30mins) it eventually deploys.

The node-red logs should include a message when the deploy is started and when it completes.

Something like:

5 Nov 09:13:40 - [info] Stopping modified nodes
15 Nov 09:13:40 - [info] Stopped modified nodes
15 Nov 09:13:40 - [info] Starting modified nodes
15 Nov 09:13:40 - [info] Started modified nodes

Most likely cause is that you have a node that is not shutting down properly when requested to (because it has a change) this should also be shown in the logs between the entries I showed above.

Note that node is consuming 127% CPU which means it is using a complete core and some more. Possibly, as suggested, one of the nodes is failing to shutdown properly and is instead sitting in a loop of some sort. Stop node red and start it again in a terminal and post the full log up to the point you try to re-deploy. If you used the recommended Ubuntu install you can use
node-red-stop
node-red-start

Sure thing,
Executed node-red-stop
Executed node-red-start

Start Node-RED

Once Node-RED has started, point a browser at http://10.10.1.205:1880
On Pi Node-RED works better with the Firefox or Chrome browser

Use   sudo systemctl enable nodered.service  to autostart Node-RED at every boot
Use   sudo systemctl disable nodered.service to disable autostart on boot

To find more nodes and example flows - go to http://flows.nodered.org

Starting as root systemd service.
15 Nov 12:35:32 - [info]
Welcome to Node-RED
===================
15 Nov 12:35:32 - [info] Node-RED version: v2.0.1
15 Nov 12:35:32 - [info] Node.js  version: v12.22.7
15 Nov 12:35:32 - [info] Linux 5.10.63-v7l+ arm LE
15 Nov 12:35:32 - [info] Loading palette nodes
15 Nov 12:35:35 - [info] Dashboard version 3.1.1 started at /ui
15 Nov 12:35:35 - [warn] ------------------------------------------------------
15 Nov 12:35:35 - [warn] [node-red-contrib-speedtest-updated/speedtest] 'speedtest' already registered by module node-red-contrib-speedtest
15 Nov 12:35:35 - [warn] ------------------------------------------------------
15 Nov 12:35:35 - [info] Settings file  : /home/pi/.node-red/settings.js
15 Nov 12:35:35 - [info] Context store  : 'default' [module=memory]
15 Nov 12:35:35 - [info] User directory : /home/pi/.node-red
15 Nov 12:35:35 - [warn] Projects disabled : editorTheme.projects.enabled=false
15 Nov 12:35:35 - [warn] Flows file name not set. Generating name using hostname.
15 Nov 12:35:35 - [info] Flows file     : /home/pi/.node-red/flows_raspberrypi.json
15 Nov 12:35:35 - [info] Server now running at http://127.0.0.1:1880/
15 Nov 12:35:35 - [warn]
---------------------------------------------------------------------
Your flow credentials file is encrypted using a system-generated key.
If the system-generated key is lost for any reason, your credentials
file will not be recoverable, you will have to delete it and re-enter
your credentials.
You should set your own key using the 'credentialSecret' option in
your settings file. Node-RED will then re-encrypt your credentials
file using your chosen key the next time you deploy a change.
---------------------------------------------------------------------
15 Nov 12:35:35 - [info] Starting flows
client.startDiscovery({"discoveryInterval":60000,"offlineTolerance":1,"breakoutChildren":false})
client.getDevice({"deviceOptions":{"host":"10.10.1.53"}})
client.getSysInfo({"host":"10.10.1.53","port":9999})
TplinkConnection(TCP 10.10.1.53:9999).send({"payload":"{\"system\":{\"get_sysinfo\":{}}}","timeout":15000})
TcpConnection(TCP 10.10.1.53:9999).getSocket()
[1] TplinkSocket(TCP).createSocket()
client.startDiscovery({"discoveryInterval":60000,"offlineTolerance":1,"breakoutChildren":false})
client.getDevice({"deviceOptions":{"host":"10.10.1.233"}})
client.getSysInfo({"host":"10.10.1.233","port":9999})
TplinkConnection(TCP 10.10.1.233:9999).send({"payload":"{\"system\":{\"get_sysinfo\":{}}}","timeout":15000})
TcpConnection(TCP 10.10.1.233:9999).getSocket()
[1] TplinkSocket(TCP).createSocket()
client.startDiscovery({"discoveryInterval":60000,"offlineTolerance":1,"breakoutChildren":false})
client.getDevice({"deviceOptions":{"host":"10.10.1.173"}})
client.getSysInfo({"host":"10.10.1.173","port":9999})
TplinkConnection(TCP 10.10.1.173:9999).send({"payload":"{\"system\":{\"get_sysinfo\":{}}}","timeout":15000})
TcpConnection(TCP 10.10.1.173:9999).getSocket()
[1] TplinkSocket(TCP).createSocket()
15 Nov 12:35:35 - [info] Started flows
[1] TplinkSocket(TCP).send({"payload":"{\"system\":{\"get_sysinfo\":{}}}","port":9999,"host":"10.10.1.53","timeout":15000})
[1] TcpSocket: socket:send payload.length 33
[1] TcpSocket: socket:send attempting to connect. host:10.10.1.53, port:9999
[1] TplinkSocket(TCP).send({"payload":"{\"system\":{\"get_sysinfo\":{}}}","port":9999,"host":"10.10.1.233","timeout":15000})
[1] TcpSocket: socket:send payload.length 33
[1] TcpSocket: socket:send attempting to connect. host:10.10.1.233, port:9999
[1] TplinkSocket(TCP).send({"payload":"{\"system\":{\"get_sysinfo\":{}}}","port":9999,"host":"10.10.1.173","timeout":15000})
[1] TcpSocket: socket:send payload.length 33
[1] TcpSocket: socket:send attempting to connect. host:10.10.1.173, port:9999
client.socket: UDP IPv4 listening on 0.0.0.0:60161
client.sendDiscovery(255.255.255.255, [], 1)
client.socket: UDP IPv4 listening on 0.0.0.0:35499
client.sendDiscovery(255.255.255.255, [], 1)
client.socket: UDP IPv4 listening on 0.0.0.0:57572
client.sendDiscovery(255.255.255.255, [], 1)
Timeout duration was set to 1.

This is stop and then start - no Deployment done.

Thank you - when you say node-red logs, I am using:

journalctl -xe -f -u nodered.service

To view the output while working with node-red, are you mentioning any other logs?

No, that should contain the information.

What do you see in the log when you re-deploy (I did ask for that)?

When you do node-red-stop (before attempting deploy) does it stop immediately?

The log you get from journalctl should be the same as you see when you run node-red-start

What do you see in the log when you re-deploy (I did ask for that)?

I don't see anything really that pops out - I have posted the output below

When you do node-red-stop (before attempting deploy) does it stop immediately?

Yes it stops immediately and restarts immediately



Start Node-RED

Once Node-RED has started, point a browser at http://10.10.1.205:1880
On Pi Node-RED works better with the Firefox or Chrome browser

Use   sudo systemctl enable nodered.service  to autostart Node-RED at every boot
Use   sudo systemctl disable nodered.service to disable autostart on boot

To find more nodes and example flows - go to http://flows.nodered.org

Starting as root systemd service.
15 Nov 13:11:21 - [info]
Welcome to Node-RED
===================
15 Nov 13:11:21 - [info] Node-RED version: v2.0.1
15 Nov 13:11:21 - [info] Node.js  version: v12.22.7
15 Nov 13:11:21 - [info] Linux 5.10.63-v7l+ arm LE
15 Nov 13:11:21 - [info] Loading palette nodes
15 Nov 13:11:24 - [info] Dashboard version 3.1.1 started at /ui
15 Nov 13:11:24 - [warn] ------------------------------------------------------
15 Nov 13:11:24 - [warn] [node-red-contrib-speedtest-updated/speedtest] 'speedtest' already registered by module node-red-contrib-speedtest
15 Nov 13:11:24 - [warn] ------------------------------------------------------
15 Nov 13:11:24 - [info] Settings file  : /home/pi/.node-red/settings.js
15 Nov 13:11:24 - [info] Context store  : 'default' [module=memory]
15 Nov 13:11:24 - [info] User directory : /home/pi/.node-red
15 Nov 13:11:24 - [warn] Projects disabled : editorTheme.projects.enabled=false
15 Nov 13:11:24 - [warn] Flows file name not set. Generating name using hostname.
15 Nov 13:11:24 - [info] Flows file     : /home/pi/.node-red/flows_raspberrypi.json
15 Nov 13:11:24 - [info] Server now running at http://127.0.0.1:1880/
15 Nov 13:11:24 - [warn]
---------------------------------------------------------------------
Your flow credentials file is encrypted using a system-generated key.
If the system-generated key is lost for any reason, your credentials
file will not be recoverable, you will have to delete it and re-enter
your credentials.
You should set your own key using the 'credentialSecret' option in
your settings file. Node-RED will then re-encrypt your credentials
file using your chosen key the next time you deploy a change.
---------------------------------------------------------------------
15 Nov 13:11:24 - [info] Starting flows
client.startDiscovery({"discoveryInterval":60000,"offlineTolerance":1,"breakoutChildren":false})
client.getDevice({"deviceOptions":{"host":"10.10.1.53"}})
client.getSysInfo({"host":"10.10.1.53","port":9999})
TplinkConnection(TCP 10.10.1.53:9999).send({"payload":"{\"system\":{\"get_sysinfo\":{}}}","timeout":15000})
Rel.120821","hw_ver":"1.0","type":"IOT.SMARTPLUGSWITCH","model":"HS110(EU)","mac":"70:4F:57:45:E1:0E","deviceId":"80067DD0A29DEB30E12BAD1F5F85C71C19058B05","hwId":"45E29DA8382494D2E82688B52A0B2EB5","fwId":"00000000000000000000000000000000","oemId":"3D341ECE302C0642C99E31CE2430544B","alias":"Garage Freezer","dev_name":"Wi-Fi Smart Plug With Energy Monitoring","icon_hash":"","relay_state":1,"on_time":331505,"active_mode":"schedule","feature":"TIM:ENE","updating":0,"rssi":-80,"led_off":0,"latitude":-26.280593,"longitude":28.123454}}}
device.constructor({"client":"not shown","_sysInfo":{"err_code":0,"sw_ver":"1.2.6 Build 200727 Rel.120821","hw_ver":"1.0","type":"IOT.SMARTPLUGSWITCH","model":"HS110(EU)","mac":"70:4F:57:45:E1:0E","deviceId":"80067DD0A29DEB30E12BAD1F5F85C71C19058B05","hwId":"45E29DA8382494D2E82688B52A0B2EB5","fwId":"00000000000000000000000000000000","oemId":"3D341ECE302C0642C99E31CE2430544B","alias":"Garage Freezer","dev_name":"Wi-Fi Smart Plug With Energy Monitoring","icon_hash":"","relay_state":1,"on_time":331505,"active_mode":"schedule","feature":"TIM:ENE","updating":0,"rssi":-80,"led_off":0,"latitude":-26.280593,"longitude":28.123454},"host":"10.10.1.233","port":9999,"defaultSendOptions":{"timeout":15000,"transport":"tcp","useSharedSocket":false,"sharedSocketTimeout":20000}})
plug.constructor()
[Garage Freezer] device sysInfo set
[Garage Freezer] plug sysInfo set
[Garage Freezer] plug.emitEvents() inUse: true relayState: true lastState: {"inUse":false,"relayState":false}
client.startDiscovery(): socket:message From: 10.10.1.53 9999 Message: {"system":{"get_sysinfo":{"err_code":0,"sw_ver":"1.2.6 Build 200727 Rel.120821","hw_ver":"1.0","type":"IOT.SMARTPLUGSWITCH","model":"HS110(EU)","mac":"70:4F:57:45:E3:BE","deviceId":"80060534F20939734EA57641FBA0BFAC1905B0B5","hwId":"45E29DA8382494D2E82688B52A0B2EB5","fwId":"00000000000000000000000000000000","oemId":"3D341ECE302C0642C99E31CE2430544B","alias":"Red Bar Fridge","dev_name":"Wi-Fi Smart Plug With Energy Monitoring","icon_hash":"","relay_state":1,"on_time":1299607,"active_mode":"schedule","feature":"TIM:ENE","updating":0,"rssi":-80,"led_off":0,"latitude":-26.280593,"longitude":28.123454}}}
device.constructor({"client":"not shown","_sysInfo":{"err_code":0,"sw_ver":"1.2.6 Build 200727 Rel.120821","hw_ver":"1.0","type":"IOT.SMARTPLUGSWITCH","model":"HS110(EU)","mac":"70:4F:57:45:E3:BE","deviceId":"80060534F20939734EA57641FBA0BFAC1905B0B5","hwId":"45E29DA8382494D2E82688B52A0B2EB5","fwId":"00000000000000000000000000000000","oemId":"3D341ECE302C0642C99E31CE2430544B","alias":"Red Bar Fridge","dev_name":"Wi-Fi Smart Plug With Energy Monitoring","icon_hash":"","relay_state":1,"on_time":1299607,"active_mode":"schedule","feature":"TIM:ENE","updating":0,"rssi":-80,"led_off":0,"latitude":-26.280593,"longitude":28.123454},"host":"10.10.1.53","port":9999,"defaultSendOptions":{"timeout":15000,"transport":"tcp","useSharedSocket":false,"sharedSocketTimeout":20000}})
plug.constructor()
[Red Bar Fridge] device sysInfo set
[Red Bar Fridge] plug sysInfo set
[Red Bar Fridge] plug.emitEvents() inUse: true relayState: true lastState: {"inUse":false,"relayState":false}
[3] TcpSocket: socket:data: segment:1 1013/1013 [{"emeter":{"get_realtime":{"current":0.326319,"voltage":228.488021,"power":51.423724,"total":9.151000,"err_code":0}},"schedule":{"get_next_action":{"type":-1,"err_code":0}},"system":{"get_sysinfo":{"err_code":0,"sw_ver":"1.2.6 Build 200727 Rel.120821","hw_ver":"1.0","type":"IOT.SMARTPLUGSWITCH","model":"HS110(EU)","mac":"70:4F:57:45:E3:BE","deviceId":"80060534F20939734EA57641FBA0BFAC1905B0B5","hwId":"45E29DA8382494D2E82688B52A0B2EB5","fwId":"00000000000000000000000000000000","oemId":"3D341ECE302C0642C99E31CE2430544B","alias":"Red Bar Fridge","dev_name":"Wi-Fi Smart Plug With Energy Monitoring","icon_hash":"","relay_state":1,"on_time":1299607,"active_mode":"schedule","feature":"TIM:ENE","updating":0,"rssi":-81,"led_off":0,"latitude":-26.280593,"longitude":28.123454}},"cnCloud":{"get_info":{"username":"carlos.magalhaes@outlook.com","server":"n-devs.tplinkcloud.com","binded":1,"cld_connection":1,"illegalType":0,"stopConnect":0,"tcspStatus":1,"fwDlPage":"","tcspInfo":"","fwNotifyType":0,"err_code":0}}}]
[3] TcpSocket: socket:close, hadError:false
[3] TplinkSocket(TCP).close()
[Red Bar Fridge] device sysInfo set
[Red Bar Fridge] plug sysInfo set
[Red Bar Fridge] plug.emitEvents() inUse: true relayState: true lastState: {"inUse":true,"relayState":true}
[3] TcpSocket: socket:data: segment:1 1004/1004 [{"emeter":{"get_realtime":{"current":0.014454,"voltage":228.673203,"power":0,"total":3.873000,"err_code":0}},"schedule":{"get_next_action":{"type":-1,"err_code":0}},"system":{"get_sysinfo":{"err_code":0,"sw_ver":"1.2.6 Build 200727 Rel.120821","hw_ver":"1.0","type":"IOT.SMARTPLUGSWITCH","model":"HS110(EU)","mac":"70:4F:57:45:E1:0E","deviceId":"80067DD0A29DEB30E12BAD1F5F85C71C19058B05","hwId":"45E29DA8382494D2E82688B52A0B2EB5","fwId":"00000000000000000000000000000000","oemId":"3D341ECE302C0642C99E31CE2430544B","alias":"Garage Freezer","dev_name":"Wi-Fi Smart Plug With Energy Monitoring","icon_hash":"","relay_state":1,"on_time":331505,"active_mode":"schedule","feature":"TIM:ENE","updating":0,"rssi":-80,"led_off":0,"latitude":-26.280593,"longitude":28.123454}},"cnCloud":{"get_info":{"username":"carlos.magalhaes@outlook.com","server":"n-devs.tplinkcloud.com","binded":1,"cld_connection":1,"illegalType":0,"stopConnect":0,"tcspStatus":1,"fwDlPage":"","tcspInfo":"","fwNotifyType":0,"err_code":0}}}]
[3] TcpSocket: socket:close, hadError:false
[3] TplinkSocket(TCP).close()
[Garage Freezer] device sysInfo set
[Garage Freezer] plug sysInfo set
[Garage Freezer] plug.emitEvents() inUse: false relayState: true lastState: {"inUse":true,"relayState":true}
15 Nov 13:12:01 - [error] [kasa:Main Bedroom Heater] Error connecting to device 10.10.1.173: Error: connect EHOSTUNREACH 10.10.1.173:9999
[1] TcpSocket: socket:close, hadError:true
[1] TcpSocket: socket:close error

It isn't showing the Stopping modified nodes message, which seems odd.

Have you tried fixing the error connecting to the bedroom heater, in case that is a factor?

Also I note you are using an early 2.x node red version, I suggest updating to the latest. Also make sure all contrib nodes are up to date (check in Manage Palette).

@Colin - firstly thank you once again for taking the time to always respond.

Have you tried fixing the error connecting to the bedroom heater, in case that is a factor?
I haven't as I know what the error is there (however I hear you and I'll sort it out now)

What I did do is that there were a few nodes on my flows that I wasn't using anymore (I use this server as a dev\test), I cleaned up quite a bit and notice the deploy is now working as per normal (for now), I am also no using full deploy and not changes only.

Also I note you are using an early 2.x node red version, I suggest updating to the latest

I will go google on how to do the upgrade, I didn't even notice that I am sure there is an upgrade article somewhere.

Also make sure all contrib nodes are up to date (check in Manage Palette).
Funny you say that, it was the first thing I did when I started getting this issue, I updated all of the contrib nodes that I had installed as I had a suspicion it was one of those.

It isn't showing the Stopping modified nodes message, which seems odd.

This is what got me in the beginning I went straight to the logs to see if there was anything erroring out or stalling but it almost seemed as if I pressed deploy on the UI it would "hang" but if I was watching the logs it was going on as per normal - I could see all the flows etc execute in the logs, however I would not see the stop and start for the nodes.

I also just ran the Pi install / upgrade script and am now on:

`
Welcome to Node-RED

15 Nov 13:39:49 - [info] Node-RED version: v2.1.3
15 Nov 13:39:49 - [info] Node.js version: v12.22.7
15 Nov 13:39:49 - [info] Linux 5.10.63-v7l+ arm LE
`

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