# Stops listening and restart won't work

**URL:** <https://discourse.nodered.org/t/stops-listening-and-restart-wont-work/777>\
**Category:** General\
**Created:** [13 June 2018 08:07 UTC](https://discourse.nodered.org/t/stops-listening-and-restart-wont-work/777 "2018-06-13T08:07:51Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![awasen](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/awasen/32/596_2.png) [@awasen](https://discourse.nodered.org/u/awasen)\
**Post date:** [13 June 2018 08:07 UTC](https://discourse.nodered.org/t/stops-listening-and-restart-wont-work/777/1 "2018-06-13T08:07:51Z")

</div>

Not really sure why this is happening and I can’t see anything in the logs but sometimes (every second/third day, or sometimes more often) the GUI stops responding. The port is still bound to 1880 and there are no errors in the logs and I’ve monitored CPU, temperature and memory and there is nothing alarming there either.

Running on a RPi 3 B and accessing it over VNC and SSH works and the GUI is also unresponsive on the RPi itself (over VNC) using the local IP so I have ruled out network issues.

Once the “unresponsiveness” happens the only thing that helps is a reboot of the RPi. Trying to restart node-red isn’t working and it just “hangs” doing nothing. `kill -9` doesn’t stop the service either.

I am running it as a “service”:  
`

# Auto restart on crash

Restart=on-failure  
`  
I also have tried to disable the “restart on crash” but that doesn’t seem to change the behavior, neither is there anything in the logs that would indicate that ta restart and/or crash has occurred…

Any suggestions for what I can look at?

---

<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:** [13 June 2018 09:10 UTC](https://discourse.nodered.org/t/stops-listening-and-restart-wont-work/777/2 "2018-06-13T09:10:55Z")

</div>

Loads of questions:  
Firstly what versions of everything? Post the output from node-red-log following a node red restart.  
If you run the command `top` in a terminal does it show the cpu is being hogged?  
Are you using MQTT? A cause of node red apparently hanging can be an MQTT loop. Try subscribing to everything from the mqtt command line client when it hangs and see if anything is going on when it hangs.  
When you say a node-red restart doesn’t work, what does node-red-log show after you try to restart.  
How are you restarting?

---

<div class="post-metadata">

**Author:** ![awasen](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/awasen/32/596_2.png) [@awasen](https://discourse.nodered.org/u/awasen)\
**Post date:** [13 June 2018 10:00 UTC](https://discourse.nodered.org/t/stops-listening-and-restart-wont-work/777/3 "2018-06-13T10:00:32Z")

</div>

Hi Colin! Thanks for your response and the excellent line of questions… 🙂

Versions:

```auto
Welcome to Node-RED
===================
13 Jun 09:30:21 - [info] Node-RED version: v0.18.2
13 Jun 09:30:21 - [info] Node.js version: v6.12.3
13 Jun 09:30:21 - [info] Linux 4.9.59-v7+ arm LE
13 Jun 09:30:24 - [info] Loading palette nodes
13 Jun 09:30:29 - [info] Dashboard version 2.8.0 started at /ui

```

Top:

```auto
%Cpu(s): 3.3 us, 0.2 sy, 2.7 ni, 93.7 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st
KiB Mem : 949580 total, 518456 free, 184604 used, 246520 buff/cache
KiB Swap: 102396 total, 102396 free, 0 used. 692032 avail Mem

```

Not using any MQTT.  
Restarting by first disabling the service `sudo systemctl disable nodered.service` and then trying `node-red-stop` but it never stops. `sudo` doesn’t make any difference. Also `kill` or `kill -9` on the node-red process isn’t stopping it, only a reboot does…

---

<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:** [13 June 2018 10:45 UTC](https://discourse.nodered.org/t/stops-listening-and-restart-wont-work/777/4 "2018-06-13T10:45:21Z")

</div>

Is the top from when it hangs? I am never sure what the %Cpu(s) line tells you, but I presume you have checked that no process is consuming lots of cpu (when it hangs).  
If `sudo kill -9` doesn’t work then something odd is going on. When it hangs and `sudo kill -9 node-red` does not work what does `ps -l <pid>` show (where `<pid>` is the pid of node-red, which you can get from `ps au|grep "node-red"`)?  
You don’t need to disable node-red to stop or restart it, just use

```auto
sudo systemctl stop nodered
sudo systemctl start nodered

```

or just

```auto
sudo systemctl restart nodered

```

You don’t need the `.service` either.  
Can you stop/start and kill -9 node-red when it is apparently operating normally?

---

<div class="post-metadata">

**Author:** ![awasen](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/awasen/32/596_2.png) [@awasen](https://discourse.nodered.org/u/awasen)\
**Post date:** [15 June 2018 12:07 UTC](https://discourse.nodered.org/t/stops-listening-and-restart-wont-work/777/5 "2018-06-15T12:07:59Z")

</div>

The `top` varies a bit when it “hangs” but is kept below 20% and idles at about 5% CPU.

It stops and restart normally when not in “hang-mode” and here are the latest logs from the last hang:

```auto
14 Jun 21:04:30 - [error] [http request:Update outside-temp] Error: socket hang up
14 Jun 21:04:30 - [error] [http request:Update outside-temp] Error: socket hang up
Stopping Node-RED graphical event wiring tool....
nodered.service: State 'stop-sigterm' timed out. Killing.
nodered.service: Killing process 336 (node-red) with signal SIGKILL.
nodered.service: Killing process 926 (nrgpio) with signal SIGKILL.
nodered.service: Killing process 928 (python) with signal SIGKILL.
nodered.service: Killing process 929 (nrgpio) with signal SIGKILL.
nodered.service: Killing process 931 (python) with signal SIGKILL.
nodered.service: Killing process 932 (nrgpio) with signal SIGKILL.
nodered.service: Killing process 934 (nrgpio) with signal SIGKILL.
nodered.service: Killing process 935 (python) with signal SIGKILL.
nodered.service: Killing process 937 (python) with signal SIGKILL.

```

I tried with a `sudo systemctl restart nodered` when the above happened…

The Raspberry PI is acting normally otherwise and there is no visible lag or any other “strangness” when node-red hangs.

---

<div class="post-metadata">

**Author:** ![davidcgu](https://avatars.discourse-cdn.com/v4/letter/d/e8c25b/32.png) [@davidcgu](https://discourse.nodered.org/u/davidcgu)\
**Post date:** [15 June 2018 12:19 UTC](https://discourse.nodered.org/t/stops-listening-and-restart-wont-work/777/6 "2018-06-15T12:19:26Z")

</div>

I use “sudo service nodered restart”(or stop or start), and for me works on a rapi 3.

Regads

---

<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:** [15 June 2018 12:26 UTC](https://discourse.nodered.org/t/stops-listening-and-restart-wont-work/777/7 "2018-06-15T12:26:29Z")

</div>

> [@awasen](#):
>
> 14 Jun 21:04:30 - [error] [http request:Update outside-temp] Error: socket hang up

Are you only getting that error when it hangs?

---

<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:** [15 June 2018 12:44 UTC](https://discourse.nodered.org/t/stops-listening-and-restart-wont-work/777/8 "2018-06-15T12:44:18Z")

</div>

> [@davidcgu](#):
>
> I use “sudo service nodered restart”(or stop or start), and for me works on a rapi 3.

I believe that does the same thing as the systemctl command

---

<div class="post-metadata">

**Author:** ![awasen](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/awasen/32/596_2.png) [@awasen](https://discourse.nodered.org/u/awasen)\
**Post date:** [15 June 2018 13:12 UTC](https://discourse.nodered.org/t/stops-listening-and-restart-wont-work/777/9 "2018-06-15T13:12:42Z")

</div>

Yes, otherwise it is working normally

---

<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:** [15 June 2018 13:36 UTC](https://discourse.nodered.org/t/stops-listening-and-restart-wont-work/777/10 "2018-06-15T13:36:51Z")

</div>

So the http request is failing with a timeout or something and that is locking up node red in such a way that you cannot even kill the process. What node are you using for the http request?

---

<div class="post-metadata">

**Author:** ![awasen](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/awasen/32/596_2.png) [@awasen](https://discourse.nodered.org/u/awasen)\
**Post date:** [15 June 2018 14:21 UTC](https://discourse.nodered.org/t/stops-listening-and-restart-wont-work/777/11 "2018-06-15T14:21:10Z")

</div>

Ah, no, sorry. I meant that it is working fine for some time and the `[http request:Update outside-temp]` is updated as they should be but then it “hangs” and then the request errors for socket hangup starts.

---

<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:** [15 June 2018 15:24 UTC](https://discourse.nodered.org/t/stops-listening-and-restart-wont-work/777/12 "2018-06-15T15:24:44Z")

</div>

Sorry I am not following you. Are you saying that the socket hangup does not happen at the same time as node red hangs?

---

<div class="post-metadata">

**Author:** ![awasen](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/awasen/32/596_2.png) [@awasen](https://discourse.nodered.org/u/awasen)\
**Post date:** [15 June 2018 19:27 UTC](https://discourse.nodered.org/t/stops-listening-and-restart-wont-work/777/13 "2018-06-15T19:27:50Z")

</div>

Sorry to confuse you… 🙂  
I don’t know if the “hanging” happens before or after the socket hangups start (I think it hangs first, but am not sure).  
I have removed the HTTP request nodes to test and it still hangs.

---

<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:** [15 June 2018 21:00 UTC](https://discourse.nodered.org/t/stops-listening-and-restart-wont-work/777/14 "2018-06-15T21:00:14Z")

</div>

> [@Colin](#):
>
> When it hangs and `sudo kill -9 node-red` does not work what does `ps -l <pid>` show (where `<pid>` is the pid of node-red, which you can get from `ps au|grep "node-red"` )?

I don't think you answered that question did you?

Also are you doing any file access from the flow, possibly with a remote or removable drive?

---

<div class="post-metadata">

**Author:** ![awasen](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/awasen/32/596_2.png) [@awasen](https://discourse.nodered.org/u/awasen)\
**Post date:** [16 June 2018 05:48 UTC](https://discourse.nodered.org/t/stops-listening-and-restart-wont-work/777/15 "2018-06-16T05:48:41Z")

</div>

```auto
ps -l 314
F S UID PID PPID C PRI NI ADDR SZ WCHAN TTY TIME CMD
4 D 1000 314 1 0 85 5 - 47349 - ? 1:00 node-red

```

Here is the output during the “hang”…

---

<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:** [16 June 2018 07:54 UTC](https://discourse.nodered.org/t/stops-listening-and-restart-wont-work/777/16 "2018-06-16T07:54:11Z")

</div>

Note that the state (under S) is shown as D, which means it is uninterruptible, hence kill -9 will not work. You did not answer my other question, are you doing any file access from the flow, possibly with a remote or removable drive? If I were a betting man I would put a small wager on the possibility that you are accessing an NFS drive.

---

<div class="post-metadata">

**Author:** ![awasen](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/awasen/32/596_2.png) [@awasen](https://discourse.nodered.org/u/awasen)\
**Post date:** [16 June 2018 08:37 UTC](https://discourse.nodered.org/t/stops-listening-and-restart-wont-work/777/17 "2018-06-16T08:37:30Z")

</div>

Sorry to disappoint, but no NFS or file access…  
I have an Arduino nano on USB with two analog sensors hooked up, 6 1-wire Ds18b20 and one DHT21 on GPIO all shows on a dashboard

---

<div class="post-metadata">

**Author:** ![ukmoose](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ukmoose/32/13_2.png) [@ukmoose](https://discourse.nodered.org/u/ukmoose)\
**Post date:** [16 June 2018 08:43 UTC](https://discourse.nodered.org/t/stops-listening-and-restart-wont-work/777/18 "2018-06-16T08:43:12Z")

</div>

Personally I’d swap out the sdcard and see if the problem reappears.

---

<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:** [16 June 2018 08:53 UTC](https://discourse.nodered.org/t/stops-listening-and-restart-wont-work/777/19 "2018-06-16T08:53:00Z")

</div>

Also it could be a power supply issue, is the PSU up to the job?

---

<div class="post-metadata">

**Author:** ![awasen](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/awasen/32/596_2.png) [@awasen](https://discourse.nodered.org/u/awasen)\
**Post date:** [16 June 2018 09:22 UTC](https://discourse.nodered.org/t/stops-listening-and-restart-wont-work/777/20 "2018-06-16T09:22:15Z")

</div>

It’s a 4A, had problems with 2A

[Next page](https://discourse.nodered.org/t/stops-listening-and-restart-wont-work/777.md?page=2)
