# How to understand why node-red restarts?

**URL:** <https://discourse.nodered.org/t/how-to-understand-why-node-red-restarts/91146>\
**Category:** General\
**Created:** [20 September 2024 15:31 UTC](https://discourse.nodered.org/t/how-to-understand-why-node-red-restarts/91146 "2024-09-20T15:31:45Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![tkreks](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/tkreks/32/40052_2.png) [@tkreks](https://discourse.nodered.org/u/tkreks)\
**Post date:** [20 September 2024 15:31 UTC](https://discourse.nodered.org/t/how-to-understand-why-node-red-restarts/91146/1 "2024-09-20T15:31:45Z")

</div>

Hello! In one of my projects, I use Node-RED for automation. I'm not a programmer at all, but Node-RED allows me to automate certain things and deepen my understanding. The gist is: I have agents on Selenium, and these agents interact with Node-RED using GET requests to receive tasks. They send results via POST requests, and specific logic is processed in Node-RED, linked to functions and MySQL. I've tried to minimize MySQL connections, and by using link-in/link-out, most of the requests are sent to MySQL, where a delay is set to limit the requests to no more than 4 per second. Everything I wanted from this system I’ve achieved, and it works perfectly. But there's one unpleasant issue: for reasons unknown to me, Node-RED restarts approximately every 5-10 minutes. The system parameters are as follows:

 ![Screenshot_40](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/e/8/e8c5afa542468aa5ecfb7b803944bbbbd3c91cb3.png)  
. Node-RED is running via pm2. The resources, as I understand, are more than sufficient:  
 ![Screenshot_41](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/9/5/95af7a52c3836998018775fc9b0e2094a23bff49.png)  
 ![Screenshot_42](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/f/e/fe9766ae7c51f3794a69a8a66c49b4575c79402b.png)  
. Sometimes, errors occurred related to writing into MySQL, but that was a problem with MySQL because the field type was set to varchar. I changed it to text, and the issue was resolved. The Node-RED logs are empty:  
 ![Screenshot_43](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/b/2/b2e61636a903d4856575615fe54060a4c705facb.png)  
Approximately 2-3 http requests are received every second. The data that is received is small, no more than 5 KB. Each such query generates about 2-3 queries in mysql. I don't think it's much to force node-red to reboot. My palette  
 ![Screenshot_44](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/a/2/a2f97250d96df5a28acd24d74838034b06af0c7b.png)

. Please help me figure out what the problem might be or how to find the root cause.

---

<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:** [20 September 2024 16:34 UTC](https://discourse.nodered.org/t/how-to-understand-why-node-red-restarts/91146/2 "2024-09-20T16:34:49Z")

</div>

1. what device are you running NR on?
2. How did you install NR?
3. Is the user actually `root`?
4. does anything show up in your system logs?

A google search using `SMP PREEMPT_DYNAMIC` (shown in the results of your `u-name -a` result) seem to indicate that NR can be preempted by another process running on the machine and that may be the cause of your problem.

see [SMP PREEMPT\_DYNAMIC Definitions | Cloud Malaya Lab](https://learn.farizizwan.com/infrastructure/system-administration-linux/redhat-derivatives/smp-preempt_dynamic-definitions)

---

<div class="post-metadata">

**Author:** ![tkreks](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/tkreks/32/40052_2.png) [@tkreks](https://discourse.nodered.org/u/tkreks)\
**Post date:** [20 September 2024 18:21 UTC](https://discourse.nodered.org/t/how-to-understand-why-node-red-restarts/91146/4 "2024-09-20T18:21:23Z")

</div>

1.virtual machine in vmware ESXi  
2.

> -dnf module enable nodejs:20  
> -dnf module list nodejs  
> -dnf install nodejs  
> -bash \<(curl -sL [https://raw.githubusercontent.com/node-red/linux-installers/master/rpm/update-nodejs-and-nodered](https://raw.githubusercontent.com/node-red/linux-installers/master/rpm/update-nodejs-and-nodered))  
> (install auto script with -  
> npm install -g pm2  
> pm2 start /usr/local/bin/node-red -- -v

1. Yes, it is a closed system that cannot be accessed from the Internet. Only some machines on the network have Internet access through a proxy. That's why we used root
2. journalctl -u node-red -e -f -n 10  
and  
dmesg | grep -i error  
is empty

Yes, I understand, but this usually happens if there are not enough resources. Or various conflicts. In this case, it's a fresh centos installation and installing only node-red on it, nothing else has been installed. Minimal installation

---

<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:** [20 September 2024 20:20 UTC](https://discourse.nodered.org/t/how-to-understand-why-node-red-restarts/91146/5 "2024-09-20T20:20:39Z")

</div>

Sorry but I'm not going to be able to help since I have no experience with the device or method you are using. Hopefully someone else will be able to chime in.

---

<div class="post-metadata">

**Author:** ![bakman2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bakman2/32/6207_2.png) [@bakman2](https://discourse.nodered.org/u/bakman2)\
**Post date:** [21 September 2024 03:46 UTC](https://discourse.nodered.org/t/how-to-understand-why-node-red-restarts/91146/6 "2024-09-21T03:46:12Z")

</div>

Did you try to setting the logging level to trace in settings.js ?  
You can also add a catch node with a debug node connected.

---

<div class="post-metadata">

**Author:** ![tkreks](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/tkreks/32/40052_2.png) [@tkreks](https://discourse.nodered.org/u/tkreks)\
**Post date:** [21 September 2024 07:35 UTC](https://discourse.nodered.org/t/how-to-understand-why-node-red-restarts/91146/7 "2024-09-21T07:35:32Z")

</div>

In my case, all logs are empty. But I found the culprit of the problem, in my case it was PM. His process was interrupted and this entailed restarting node-red. I redid the node-red launch into a service and now it works as it should.

---

<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:** [5 October 2024 07:35 UTC](https://discourse.nodered.org/t/how-to-understand-why-node-red-restarts/91146/8 "2024-10-05T07:35:58Z")

</div>

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