Node red random restart

As un update. I've upgraded Node-Red with the following command

sudo npm install -g --unsafe-perm node-red

The process successfully updated Node-Red to v 1.0.6. The node version is still the v 8.16.01 and also the npm version remain the v. 6.4.1 (the same versions that were running before the Node-Red upgrade). As I expected the MQTT node-out will not connect anymore to my "old" MQTT broker (mosquitto v 1.4.15) but on the contrary another MQTT-out node (in the same flow) will connect without problem to "a different" and "new" (dockerized) mqtt broker that I set-up and run on another machine. In the log file of the "old" mqtt broker I can see the RASP MQTT client connection attempt but the broker reject the connection throwing a "client unknow" error (even if I didn't change at all the MQTT Broker configuration in my flows after upgrading Node-Red). Anyway, the fact that my flows - even after the Node-Red upgrade - successfully connect to the new mqtt broker tells me that the problem is not related to the Node-Red upgrade but - probably - to a particular "combination" between Node-Red version and my MQTT broker configuration (I'll try to compare the "old" mqtt broker configuration with the "new" one in order to see if there are some differences).

In the meantime I'll leave my flows to run and see if the SEGV error appears again (cross fingers).

What mqtt broker are you using?

mosquitto eclipse. One is installed on a VPS and the other is in a docker.

For what concerns the Node-Red upgrade is it correct that the node version remain the same ? You were talking about upgrading the node version to a version between 10 or 12... The Node-Red upgrade script that I run was expected to upgrade the node.js version too? Sorry for this basic question but I'm a newby in this field :grin:

The command you showed
sudo npm install -g --unsafe-perm node-red
just installs the latest version of node-red. The script to update everything is the one at https://nodered.org/docs/getting-started/raspberrypi that I linked to earlier. However, as I said, you should first uninstall nodejs and npm as the script won't take out nodejs v8 as technically it is still supported by node-red. So
sudo apt remove nodejs npm
then run the script

Ok, so I followed your suggestion and uninstall node and npm before lauching the install/update script. At the end I've successfully update both node.js and npm. Now I'm running Node-Red v 1.0.6, node.js 12.18.0 and npm v 6.14.4.
When I try to start Node-Red I get an error due to the fact that some nodes (used in my flows) were compiled using an old version on node.js and for this reason I cannot start my flows. I've tried with the npm rebuild command but it didn't fixed. I'll try to uninstall and re-install the relative palettes.

I'll keep you update

The script should (probably did) run npm rebuild for you.
It may be that the version of those nodes is not compatible with nodejs 12. Rather than re-installing you could update from Manage Palette in node red, but remove/install should achieve the same thing.

After upgrading node.js and npm to the latest versions it seems that I've solved the SEGV problem and Node-Red didn't randomly restart :grinning: :grinning: :grinning:
Thanks for guiding me to the right direction.
Anyway I've got some palettes that even if I uninstall and install back always prompt me with an error.
Below a snapshot of the Palette Manager

The palette are the following:

ncd-red-comm
node-red-contrib-ads1x15
node-red-contrib-mcp23017chip

The first one (ncd-rec-comm) reported an [object Object] error, while the other two (ads1x15 and mcp23017chip) report an error regarding the compiling that sound like this:

...was compiled against a different Node.js version using NODE_MODULE_VERSION 57. This version of Node.js requires NODE_MODULE_VERSION 72. Please try re-compiling or re-installing the module (for instance, using `npm rebuild` or `npm install`). (line:3)

I've tried to uninstall the node-red-contrib-mcp23017chip (after removing all the related nodes from my flows) and then install it back by using the Palette Manager, but Palette Manager always show me the same error...I didn't try to uninstall the node-red-contrib-ads1x15 palette and the reinstall it but I suppose that I'll face the same error of the mcp23017 palette and that the compiling error will still remain..
For what concerns instead the ncd-red-comm (that I suppose is a default palette because I didn't recall to have install it) what can I do? Can I remove it without problem (from the Palette Manager it seems that is not used in my flows)?
After solving the SEGV error I don't want to cause other problem to my flows :worried:

Interesting.

I have an old 2a model. I am kind of flogging it, but the average load is about 40%.

It is headless.

I have put a watchdog on it but now and then it either reboots or node-red restarts.
I can't say which. But the uptime value isn't reset. So: node-red restart?

Not sure.

Yeah, the watchdog could have been invoked too. I don't know how to find out if this is true.

But: these occasional restarts where I am shown the machine has had a reboot (or more so: restart) could be explained by this.

Though I am using stretch. not buster.

Interesting.

I have never heard of node-red-comm and it doesn't appear to exist in the npm repo. I suggest removing that first. It isn't in use so shouldn't be a problem.
Unfortunately, looking at the github repository for node-red-contrib-ads1x15 it seems it has been broken for a long time (https://github.com/cinqueon/node-red-contrib-ads1x15/issues) so I can't really help there. I haven't looked at the other one but since it is showing a similar error I suspect it may be the same problem. To find the repository for a node if you search for it on the node-red flows page there should be a link to the github repo there.
If you need those nodes I suggest starting a new thread with the nodes in the subject line so it may attract the attention of someone who knows about them.

Ok. Thanks for your prompt reply Colin, I'll do in that way.