# Hung during deploy

**URL:** <https://discourse.nodered.org/t/hung-during-deploy/8114>\
**Category:** General\
**Created:** [18 February 2019 18:38 UTC](https://discourse.nodered.org/t/hung-during-deploy/8114 "2019-02-18T18:38:58Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![fabnavigator](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/fabnavigator/32/5403_2.png) [@fabnavigator](https://discourse.nodered.org/u/fabnavigator)\
**Post date:** [18 February 2019 18:38 UTC](https://discourse.nodered.org/t/hung-during-deploy/8114/1 "2019-02-18T18:38:58Z")

</div>

I was just making flow changes, and out of the blue when I pressed deploy, I got a server not responding message. I checked and the server is fine, but node-red isn't working anymore. When I try to stop it I get

```auto
Stopping Node-RED graphical event wiring tool...
nodered.service: State 'stop-sigterm' timed out. Killing.
nodered.service: Killing process 1542 (node-red) with signal SIGKILL.
nodered.service: Main process exited, code=killed, status=9/KILL
Stopped Node-RED graphical event wiring tool.
nodered.service: Unit entered failed state.
nodered.service: Failed with result 'timeout'.

```

It ends up stopped, and when I start it, everything looks like it's starting up, but I can't connect to it from my browser. What's my next step to bring it back to life?

---

<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:** [18 February 2019 20:32 UTC](https://discourse.nodered.org/t/hung-during-deploy/8114/2 "2019-02-18T20:32:25Z")

</div>

Run, in a terminal

```bash
node-red-stop
node-red-start

```

and see what you get. Post it here if necessary, from the Welcome to node-red message. If you haven't got those commands then

```bash
sudo journalctl -f -n 25 -u nodered -o cat

```

and if necessary restart node-red

---

<div class="post-metadata">

**Author:** ![fabnavigator](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/fabnavigator/32/5403_2.png) [@fabnavigator](https://discourse.nodered.org/u/fabnavigator)\
**Post date:** [19 February 2019 01:04 UTC](https://discourse.nodered.org/t/hung-during-deploy/8114/3 "2019-02-19T01:04:40Z")

</div>

# Welcome to Node-RED

18 Feb 20:03:13 - [info] Node-RED version: v0.19.5  
18 Feb 20:03:13 - [info] Node.js version: v10.15.1  
18 Feb 20:03:13 - [info] Linux 4.14.79-v7+ arm LE  
18 Feb 20:03:14 - [info] Loading palette nodes  
18 Feb 20:03:19 - [info] Dashboard version 2.13.2 started at /xxx/ui  
18 Feb 20:03:19 - [info] Settings file : /home/user/.node-red/settings.js  
18 Feb 20:03:19 - [info] Context store : 'default' [module=localfilesystem]  
18 Feb 20:03:19 - [info] Context store : 'memory' [module=memory]  
18 Feb 20:03:20 - [info] User directory : /home/user/.node-red  
18 Feb 20:03:20 - [info] Server now running at [https://127.0.0.1](https://127.0.0.1):nnn/xxx/  
18 Feb 20:03:20 - [info] Active project : Automation  
18 Feb 20:03:20 - [info] Flows file : /home/user/.node-red/projects/Automation/flows\_home-assistant.json  
18 Feb 20:03:20 - [info] Starting flows  
18 Feb 20:03:20 - [info] Started flows  
18 Feb 20:03:21 - [info] [server:Home Assistant] WebSocket Connected to [https://xxx.duckdns.org](https://xxx.duckdns.org):nnn

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [19 February 2019 01:18 UTC](https://discourse.nodered.org/t/hung-during-deploy/8114/4 "2019-02-19T01:18:29Z")

</div>

What did you change before the problem occured?

---

<div class="post-metadata">

**Author:** ![fabnavigator](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/fabnavigator/32/5403_2.png) [@fabnavigator](https://discourse.nodered.org/u/fabnavigator)\
**Post date:** [19 February 2019 01:56 UTC](https://discourse.nodered.org/t/hung-during-deploy/8114/5 "2019-02-19T01:56:15Z")

</div>

I was just playing around with a flow I' ve been working on for days. I'm working on a dashboard that sends out gets and posts to my Bose stereo. Nothing memorable right before the deploy that hung. I did apply an update to the websockets node that was installed. I have a connection to my Home Assistant instance that uses websockets. I haven't done anything with that part of my flow in a while. I restarted after that update and was working for a while before the problem. I have my project in git, and did a commit about an hour before this happened.

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [19 February 2019 02:01 UTC](https://discourse.nodered.org/t/hung-during-deploy/8114/6 "2019-02-19T02:01:24Z")

</div>

does it continue to hang after you bring it backup?

I notice you are not running on port 1880...why?

What websocket node are you using?

---

<div class="post-metadata">

**Author:** ![fabnavigator](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/fabnavigator/32/5403_2.png) [@fabnavigator](https://discourse.nodered.org/u/fabnavigator)\
**Post date:** [19 February 2019 02:16 UTC](https://discourse.nodered.org/t/hung-during-deploy/8114/7 "2019-02-19T02:16:57Z")

</div>

As far as I can tell, it doesn't come up. I can't connect to it fro my browser anymore. I just switched ports for a bit of added security. I'm not sure what websockets I have, and I don't know how to check with the system down.

---

<div class="post-metadata">

**Author:** ![fabnavigator](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/fabnavigator/32/5403_2.png) [@fabnavigator](https://discourse.nodered.org/u/fabnavigator)\
**Post date:** [19 February 2019 03:20 UTC](https://discourse.nodered.org/t/hung-during-deploy/8114/8 "2019-02-19T03:20:18Z")

</div>

I started in debug mode and found out what the websocket node was:

```auto
node-red-contrib-home-assistant-websocket

```

---

<div class="post-metadata">

**Author:** ![fabnavigator](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/fabnavigator/32/5403_2.png) [@fabnavigator](https://discourse.nodered.org/u/fabnavigator)\
**Post date:** [19 February 2019 03:31 UTC](https://discourse.nodered.org/t/hung-during-deploy/8114/9 "2019-02-19T03:31:42Z")

</div>

So, I reloaded the my project flow from github and I'm back in action. I guess the flow file got corrupted somehow?

---

<div class="post-metadata">

**Author:** ![fabnavigator](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/fabnavigator/32/5403_2.png) [@fabnavigator](https://discourse.nodered.org/u/fabnavigator)\
**Post date:** [19 February 2019 04:15 UTC](https://discourse.nodered.org/t/hung-during-deploy/8114/10 "2019-02-19T04:15:09Z")

</div>

I recreated the additional changes since the last commit and it hung again. I was changing some js in a function. It looks like this is repeatable.

---

<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:** [19 February 2019 07:21 UTC](https://discourse.nodered.org/t/hung-during-deploy/8114/11 "2019-02-19T07:21:14Z")

</div>

Have you got a loop in your js? You could post it for us to have a look at.

---

<div class="post-metadata">

**Author:** ![fabnavigator](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/fabnavigator/32/5403_2.png) [@fabnavigator](https://discourse.nodered.org/u/fabnavigator)\
**Post date:** [19 February 2019 11:22 UTC](https://discourse.nodered.org/t/hung-during-deploy/8114/12 "2019-02-19T11:22:41Z")

</div>

We have a winner!

Not only did I have a loop, but I had an infinite loop! And the icing on the cake is the fact that when my flow starts it has an injection node that calls that function immediately. Without that injection node the deploy would have returned successful, and NR would only have hung up when I manually called the function.

Some good lessons learned here for me.

1. node-red-stop will eventually stop NR, even when an infinite loop is running. It just takes a few minutes.
2. Once NR is stopped I can easily recover from the last flow saved in github.
3. Be very careful when using an injection node that is set to automatically inject after a deploy.
4. No more infinite loops in functions!

Thanks for your help!
