How to understand why node-red restarts?

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:


. Node-RED is running via pm2. The resources, as I understand, are more than sufficient:
Screenshot_41
Screenshot_42
. 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:

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

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

1 Like
  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

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)
(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

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.

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.

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.

1 Like

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