Node red restart by itself

Hello,
I am using nodered on a raspberry 4b, in a docker container using IOTStack configuration.

I use nodered mainly to get data from OPC UA and inject them in influxDB but also for interface with OpenWeather or Shelly equipment using MQTT and HTTP requests

Recently I added the telegram interface in order to send message to my iPhone.

I create a very simple telegram message generated at each nodered restart .

And I noticed that nodered is restarting by himself sometimes.
How can I find the reason of the nodered restart . There must be a log somewhere.
Is there a way to read this log file from nodered at the restart time and send the content by mail or by telegram ?

Remark :
I am using two nodered containers: an old one running nodered 1.2.6 and a new one running 3.0.2.

My plan is to migrate all flow from the old to the new, flow by flow, deploying, testing the updated flow one by one.

For now only the old nodered generate the auto restart.
On the new I already implement some of the old flow but not all of them.

Thanks for any help

If it is running in docker you can do:

// docker logs --since=<timeframe> container-name
// or 
// docker logs --tail <number of lines> container-name

eg.

docker logs --since=8h nodered
docker logs --tail 1000 nodered
1 Like

Thanks, are there similar commands that I can run directly inside the container from one exec node?

Hello,
the command
docker logs -- until (timestamp of the nodered restart) nodered
did not give any result.
I tried a simple
docker logs --tail 50 nodered
this gave me the same opc ua error repeating but i cannot find any timestamp, how can i know when this error is occuring and really troubleshoot the problem...

cannot find private stuff for Application.Echange
Error
    at EXTENSION.get schema [as schema] (/data/node_modules/node-opcua-schemas/dist/source/dynamic_extension_object.js:326:25)
    at EXTENSION.toString (/data/node_modules/node-opcua-factory/dist/factories_baseobject.js:376:18)
    at EXTENSION.toString (/data/node_modules/node-opcua-schemas/dist/source/dynamic_extension_object.js:564:26)
    at Object.encodeObject (/usr/src/node-red/node_modules/@node-red/util/lib/util.js:804:45)
    at sendDebug (/usr/src/node-red/node_modules/@node-red/nodes/core/common/21-debug.js:197:24)
    at /usr/src/node-red/node_modules/@node-red/nodes/core/common/21-debug.js:174:29
    at prepareValue (/usr/src/node-red/node_modules/@node-red/nodes/core/common/21-debug.js:70:17)
    at DebugNode._inputCallback (/usr/src/node-red/node_modules/@node-red/nodes/core/common/21-debug.js:157:17)
    at hooks.trigger (/usr/src/node-red/node_modules/@node-red/runtime/lib/nodes/Node.js:203:26)
    at Object.trigger (/usr/src/node-red/node_modules/@node-red/runtime/lib/hooks.js:113:9)
    at DebugNode.Node._emitInput (/usr/src/node-red/node_modules/@node-red/runtime/lib/nodes/Node.js:195:11)
    at DebugNode.Node.emit (/usr/src/node-red/node_modules/@node-red/runtime/lib/nodes/Node.js:179:25)
    at DebugNode.Node.receive (/usr/src/node-red/node_modules/@node-red/runtime/lib/nodes/Node.js:476:10)
    at Immediate._onImmediate (/usr/src/node-red/node_modules/@node-red/runtime/lib/flows/Flow.js:657:52)
    at runCallback (timers.js:705:18)
    at tryOnImmediate (timers.js:676:5)
    at processImmediate (timers.js:658:5)
cannot find private stuff for Application.Echange
Error
    at EXTENSION.get schema [as schema] (/data/node_modules/node-opcua-schemas/dist/source/dynamic_extension_object.js:326:25)
    at EXTENSION.toString (/data/node_modules/node-opcua-factory/dist/factories_baseobject.js:376:18)
    at EXTENSION.toString (/data/node_modules/node-opcua-schemas/dist/source/dynamic_extension_object.js:564:26)
    at Object.encodeObject (/usr/src/node-red/node_modules/@node-red/util/lib/util.js:804:45)
    at sendDebug (/usr/src/node-red/node_modules/@node-red/nodes/core/common/21-debug.js:197:24)
    at /usr/src/node-red/node_modules/@node-red/nodes/core/common/21-debug.js:174:29
    at prepareValue (/usr/src/node-red/node_modules/@node-red/nodes/core/common/21-debug.js:70:17)
    at DebugNode._inputCallback (/usr/src/node-red/node_modules/@node-red/nodes/core/common/21-debug.js:157:17)
    at hooks.trigger (/usr/src/node-red/node_modules/@node-red/runtime/lib/nodes/Node.js:203:26)
    at Object.trigger (/usr/src/node-red/node_modules/@node-red/runtime/lib/hooks.js:113:9)
    at DebugNode.Node._emitInput (/usr/src/node-red/node_modules/@node-red/runtime/lib/nodes/Node.js:195:11)
    at DebugNode.Node.emit (/usr/src/node-red/node_modules/@node-red/runtime/lib/nodes/Node.js:179:25)
    at DebugNode.Node.receive (/usr/src/node-red/node_modules/@node-red/runtime/lib/nodes/Node.js:476:10)
    at Immediate._onImmediate (/usr/src/node-red/node_modules/@node-red/runtime/lib/flows/Flow.js:657:52)
    at runCallback (timers.js:705:18)
    at tryOnImmediate (timers.js:676:5)
    at processImmediate (timers.js:658:5)

Thanks gor any help on understanding which node is creating the problem.

(Just in passing)

I had a lot of problems a while back now. Machine would do weird things and MQTT messages get sent at the wrong times, and all sorts of strange things.

Turned out to be POWER SUPPLY problems.

I would suggest trying another (bigger) one just to rule it out.

I was really annoyed after months of that kind of problem and my stubbornness to accept/believe it was that.

So you mean that solution coumd be a power off /power on of the rapsberry?
My Nodered is running on docker container, so i would bellieve that restart the container should do the same.

today i got a nodered restart at 5:01 AM and i was already wake up so i could check directly the log file.
using the -t option give me the needed time stamp , i stored it in a file
docker logs --until 15m -t nodered >nodered_log_file.txt
unfortunately, it does not show anything else than my OPC UA error messages.

2022-09-29T03:01:36.406907782Z cannot find private stuff for Application.Echange
2022-09-29T03:01:36.407778959Z Error
2022-09-29T03:01:36.407854700Z     at EXTENSION.get schema [as schema] (/data/node_modules/node-opcua-schemas/dist/source/dynamic_extension_object.js:326:25)
2022-09-29T03:01:36.407898995Z     at EXTENSION.toString (/data/node_modules/node-opcua-factory/dist/factories_baseobject.js:376:18)
2022-09-29T03:01:36.407937773Z     at EXTENSION.toString (/data/node_modules/node-opcua-schemas/dist/source/dynamic_extension_object.js:564:26)
2022-09-29T03:01:36.407974976Z     at Object.encodeObject (/usr/src/node-red/node_modules/@node-red/util/lib/util.js:804:45)
2022-09-29T03:01:36.408012680Z     at sendDebug (/usr/src/node-red/node_modules/@node-red/nodes/core/common/21-debug.js:197:24)
2022-09-29T03:01:36.408048790Z     at /usr/src/node-red/node_modules/@node-red/nodes/core/common/21-debug.js:174:29
2022-09-29T03:01:36.408084623Z     at prepareValue (/usr/src/node-red/node_modules/@node-red/nodes/core/common/21-debug.js:70:17)
2022-09-29T03:01:36.408120882Z     at DebugNode._inputCallback (/usr/src/node-red/node_modules/@node-red/nodes/core/common/21-debug.js:157:17)
2022-09-29T03:01:36.408156345Z     at hooks.trigger (/usr/src/node-red/node_modules/@node-red/runtime/lib/nodes/Node.js:203:26)
2022-09-29T03:01:36.408192382Z     at Object.trigger (/usr/src/node-red/node_modules/@node-red/runtime/lib/hooks.js:113:9)
2022-09-29T03:01:36.408229307Z     at DebugNode.Node._emitInput (/usr/src/node-red/node_modules/@node-red/runtime/lib/nodes/Node.js:195:11)
2022-09-29T03:01:36.408264733Z     at DebugNode.Node.emit (/usr/src/node-red/node_modules/@node-red/runtime/lib/nodes/Node.js:179:25)
2022-09-29T03:01:36.408300325Z     at DebugNode.Node.receive (/usr/src/node-red/node_modules/@node-red/runtime/lib/nodes/Node.js:476:10)
2022-09-29T03:01:36.408336084Z     at Immediate._onImmediate (/usr/src/node-red/node_modules/@node-red/runtime/lib/flows/Flow.js:657:52)
2022-09-29T03:01:36.408419824Z     at runCallback (timers.js:705:18)
2022-09-29T03:01:36.408458657Z     at tryOnImmediate (timers.js:676:5)
2022-09-29T03:01:36.408492546Z     at processImmediate (timers.js:658:5)
2022-09-29T03:02:42.427782999Z cannot find private stuff for Application.Echange
2022-09-29T03:02:42.427961404Z Error
2022-09-29T03:02:42.428016274Z     at EXTENSION.get schema [as schema] (/data/node_modules/node-opcua-schemas/dist/source/dynamic_extension_object.js:326:25)
2022-09-29T03:02:42.428068848Z     at EXTENSION.toString (/data/node_modules/node-opcua-factory/dist/factories_baseobject.js:376:18)
2022-09-29T03:02:42.428119311Z     at EXTENSION.toString (/data/node_modules/node-opcua-schemas/dist/source/dynamic_extension_object.js:564:26)
2022-09-29T03:02:42.428169014Z     at Object.encodeObject (/usr/src/node-red/node_modules/@node-red/util/lib/util.js:804:45)
2022-09-29T03:02:42.428217884Z ....

there must be another tool to find the reason of the nodered restart...
here i can only see that i got no OPC error coming 3 time every 70 s that is precisely the period i defined for my OPC UA subscribe interval.
Are there some options somwhere to specify more system message in the log?

How do you know node-red actually restarted if the log does not show it.
Is your telegram restart notification flow actually correct ?

Not so much "on/off" but not enough.

If the machine (RasPi) needs 2.3A and the supply can only give 2A you are in trouble.

I suffered 4 months of restarts and resets. The supply wasn't good enough/able to supply enough power.

At least try a bigger supply for a week or so and see what happens.

I thought I was being smart and had nodes looking for the Pi saying "Hey! LOW VOLTAGE!" but I never saw the messages.

But I replaced the supply with a bigger/better one and all was good from that point on wards.

1 Like

Hello,
i made a very basic
image


and it works perfectly each time i restart nodered by deploy . so i am pretty sure that nodered is restarting. I still wonder what can trigger a restart without any message log
image
later at 6:20, i forced nodered to restart and got excactly same message on telegram
image

I found out that the log setting was set "info" level in setting.js but fatal error should be logged

Thanks for the idea
my RPI Power supplies are rated 3A, it shoud be enough

Ok, but for the sake of being sure: get another one and try it.

Preferably one you have used and know works - as in the machine using it is stable.

Lemons can happen and if the supply is RATED at 3A but only delivers 2.2A you are in a world of hurt.

Using a BRAND NEW / UNTESTED unit won't (or may not) prove anything. It too could be a lemon. Or not.
But if you haven't run a machine from it like the suspect machine you can't be sure.
It is better to use a known working one rather than a new one just out of the box.

Where does that restart message comes from?

From an inject node configured to trigger at nodered start.

Pierre RUWET

As well as making that send the telegram message, feed it into a debug node set to output to the System Console, then it will appear in the node-red log.

Info messages will include the node-red startup messages.

Please force a node-red restart and show us what you see in the logs when you do that.

Thanks for your messages, I think there is a misunderstanding .
Nodered is restarting sometimes by itself and I just try to understand what is the cause of this restart. The message to telegram was the way I detected this restart.
I don’t need to add this in the log… I thought that at restart, there would be other message generated by nodered itself but it seems not to be the case… and that before the restart message the log would indicate which fatal error caused the restart.
Perhaps I am searching in the wrong log file…

Pierre RUWET

I don't agree. You are seeing that message, but it is not yet proved that node-red is restarting. That is why I asked that you to add the debug node and to force a reset so we can check that you are looking in the right place. I suspect that in fact the question that needs to be asked is "why am I getting a message telling me that node red has restarted when in fact it has not restarted". There are three possible things happening.

  1. Node red is restarting when it should not, but it does not show in the log
  2. Node red is not restarting but the Inject node is triggering when it should not.
  3. The inject node is not triggering, but you are getting a telegram message anyway.

We need to work out which one of those it is.

Ok i understand your doubt… perhaps I didn’t explain enough why I am convinced of a real restart.

The other reasons that make me think of a complete restart of nodered is the fact that when i deploy a change of flow, this inject node is triggered too and sending a message to telegram, so the trigger node is working and is only linked to that telegram, I am sure that if I add instruction to add it the log it will be there…

The next 2 messages in the telegram screenshot after nodered restart are status of OPCUA communication that comes after each restart too
This message is generated by a timeout node ( notice that I recently add the topic « nodered-old » that was empty. I did this to differentiate with my nodered-test that send also telegram message on the same channel)

and the 3rd is a change status of a alarm word read from OPC UA.
At the start of nodered’ the previous state is unknown and initiate to 0 by command
var memo_dwAlm=flow.get("memo_dwAlm")||0;
And this make me think that the context variable are lost which can occur only at a nodered restart .

Notice that a deploy will generate the first two messages but not the third because the flow context is not lost at a deploy.

I hope it helps you to go to the right investigation path and help me to dig into the real problem troubleshooting

Please do what I asked earlier, feed the inject node into a named debug node set to output to the system console, then force a restart. See what appears in the node red log. Only by finding the restart in the log will you find out why it restarts.