May also need to stop node-red, check that all node-red processes have gone away and then restart node-red.
You can simply stop node-red, delete the ~/.node-red/node_modules folder and then run npm install from the ~/.node-red/ folder before restarting node-red.
As suggested above, check to ensure that all node-red related processes have gone away before restarting.
Do you mean that stopping and restarting mosquitto fixed it, without any changes to the flow? If so then that means that it is a conditional loop that can be triggered by some event. Wait till it happens again and then use MQTTExplorer to find the topic.
Do you mean that you only have those two nodes in your complete set of flows, or that you have disabled everything else?
As a side note the 'out of memory' crash was likely a side effect of the processor overload. Node red was trying to do lots of stuff but could not keep up with events so queues of messages built up on nodes until eventually it ran out of memory and crashed.
Mosquitto STOP - see screenshot with sudo systemctl stop mosquitto above it. CPU usage went right down, still 'ghost' processes
Final screenshot shows ONLY MQTT In and MQTT out Nodes connected to server. There is only ONE MQTT In node and ONE MQTT Out node for all of my flows - I have a MQTT Master Out Flow which handles distribution of ALL MQTT messages.
Yup, I figured I was low on Processor Power and/or Memory, but, as I say, this was a stable reliable server until the WiFi Router failed and I 'lost' NR Server due to incorrect DHCP setting in my temporary fix (a far less capable Plusnet Hub One Router). DHCP error fixed (disabled) and all is where it should be in the Network.
I haven't seen any evidence of that. You have a conditional loop triggered by some condition. When it happens again use MQTTExplorer to find the culprit.
I thought that was the bast way, not too many connections to MQTT. I do have Switcg nodes and Junctions I can enable disable various 'branches' that come in to MQTT Out and are distributed from MQTT In. so I can enable/disable sending/distribution of various MQTT Topics
I don't know that it really makes any difference to be honest.
I use something similar - though I tend to do it at the flow tab level rather than universally. And typically have 2 mqtt-out's, one for retained topics and one for not retained.
But really, everything goes through one set of code and a single loop eventually I think?
Interesting. The 2 MQTT Out(s) is something I hadn't though of. My understanding is that NR is a flow and so you wouldn't get MQTT In or Out messages colliding, but then I am way down the Tech Chain! I just recall some posts suggesting fewer MQTT or Telegram Connections to reduce problems, so that is what I have done.
I think I have located the Link Out to the MQTT Sender causing the problem. Need to confirm and then find out why!
Enable Debug 35 and exercise all your lights etc. At some point you will likely see the debug become flooded with output.
Since you are subscribing to # then every time you output to MQTT you will get it back via the MQTT In node. One of those is not being correctly filtered in the switch and ends up outputing to MQTT again, or perhaps there is more than one topic involved, writing to A comes back via the In node, and causes a write to B, which comes in and causes a write to A again, and so on.
I will come back with a definitive answer, but I have disabled a Link Node to MQTT OUT and all calms down with the Processes. However, I have done nothing to this particular part of the routine, it doesn't rely on any MQTT Input, just sunrise and sunset times!!
You won't, but having two out nodes, one for retained and one for not makes it easy to see from the flow which ones are retained. I generally do the same as Julian, each flow has two (if required) Out nodes configured as described. The topic is passed via msg.topic.
There is no significant overhead in using many in and out nodes as they all use the same mqtt config node so there will still only be one connection to the server.