# Node red restart by itself

**URL:** <https://discourse.nodered.org/t/node-red-restart-by-itself/68100>\
**Category:** General\
**Created:** [22 September 2022 21:01 UTC](https://discourse.nodered.org/t/node-red-restart-by-itself/68100 "2022-09-22T21:01:32Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![piwi447](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/piwi447/32/67335_2.png) [@piwi447](https://discourse.nodered.org/u/piwi447)\
**Post date:** [22 September 2022 21:01 UTC](https://discourse.nodered.org/t/node-red-restart-by-itself/68100/1 "2022-09-22T21:01:32Z")

</div>

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

---

<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:** [23 September 2022 04:12 UTC](https://discourse.nodered.org/t/node-red-restart-by-itself/68100/2 "2022-09-23T04:12:00Z")

</div>

If it is running in docker you can do:

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

```

eg.

```auto
docker logs --since=8h nodered
docker logs --tail 1000 nodered

```

---

<div class="post-metadata">

**Author:** ![piwi447](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/piwi447/32/67335_2.png) [@piwi447](https://discourse.nodered.org/u/piwi447)\
**Post date:** [24 September 2022 06:42 UTC](https://discourse.nodered.org/t/node-red-restart-by-itself/68100/3 "2022-09-24T06:42:56Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![piwi447](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/piwi447/32/67335_2.png) [@piwi447](https://discourse.nodered.org/u/piwi447)\
**Post date:** [26 September 2022 17:48 UTC](https://discourse.nodered.org/t/node-red-restart-by-itself/68100/4 "2022-09-26T17:48:54Z")

</div>

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...

```auto
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.

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [26 September 2022 21:48 UTC](https://discourse.nodered.org/t/node-red-restart-by-itself/68100/5 "2022-09-26T21:48:44Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![piwi447](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/piwi447/32/67335_2.png) [@piwi447](https://discourse.nodered.org/u/piwi447)\
**Post date:** [29 September 2022 17:32 UTC](https://discourse.nodered.org/t/node-red-restart-by-itself/68100/6 "2022-09-29T17:32:08Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![piwi447](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/piwi447/32/67335_2.png) [@piwi447](https://discourse.nodered.org/u/piwi447)\
**Post date:** [30 September 2022 03:51 UTC](https://discourse.nodered.org/t/node-red-restart-by-itself/68100/7 "2022-09-30T03:51:06Z")

</div>

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.

```auto
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?

---

<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:** [30 September 2022 04:34 UTC](https://discourse.nodered.org/t/node-red-restart-by-itself/68100/8 "2022-09-30T04:34:27Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [30 September 2022 05:37 UTC](https://discourse.nodered.org/t/node-red-restart-by-itself/68100/9 "2022-09-30T05:37:38Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![piwi447](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/piwi447/32/67335_2.png) [@piwi447](https://discourse.nodered.org/u/piwi447)\
**Post date:** [30 September 2022 20:40 UTC](https://discourse.nodered.org/t/node-red-restart-by-itself/68100/10 "2022-09-30T20:40:35Z")

</div>

Hello,  
i made a very basic  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/c/8/c851b94e059e6827a546b14217be24464b192d45.png)

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/c/3/c3032caf0c12445f243033ca48d015becac903e0.png)  
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](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/e/8/e86346bbaa84e2ec116ecb7bb344251dc2ed2cc4.png)  
later at 6:20, i forced nodered to restart and got excactly same message on telegram  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/b/1/b134290bbf2edd4066fba300bd52e8486b72c45c.png)

---

<div class="post-metadata">

**Author:** ![piwi447](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/piwi447/32/67335_2.png) [@piwi447](https://discourse.nodered.org/u/piwi447)\
**Post date:** [30 September 2022 20:45 UTC](https://discourse.nodered.org/t/node-red-restart-by-itself/68100/11 "2022-09-30T20:45:04Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![piwi447](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/piwi447/32/67335_2.png) [@piwi447](https://discourse.nodered.org/u/piwi447)\
**Post date:** [30 September 2022 20:54 UTC](https://discourse.nodered.org/t/node-red-restart-by-itself/68100/12 "2022-09-30T20:54:07Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [30 September 2022 22:42 UTC](https://discourse.nodered.org/t/node-red-restart-by-itself/68100/13 "2022-09-30T22:42:03Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [1 October 2022 06:28 UTC](https://discourse.nodered.org/t/node-red-restart-by-itself/68100/14 "2022-10-01T06:28:17Z")

</div>

Where does that restart message comes from?

---

<div class="post-metadata">

**Author:** ![piwi447](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/piwi447/32/67335_2.png) [@piwi447](https://discourse.nodered.org/u/piwi447)\
**Post date:** [1 October 2022 18:05 UTC](https://discourse.nodered.org/t/node-red-restart-by-itself/68100/15 "2022-10-01T18:05:07Z")

</div>

From an inject node configured to trigger at nodered start.

Pierre RUWET

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [1 October 2022 18:52 UTC](https://discourse.nodered.org/t/node-red-restart-by-itself/68100/16 "2022-10-01T18:52:49Z")

</div>

> [@piwi447](#):
>
> From an inject node configured to trigger at nodered start.

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.

> [@piwi447](#):
>
> I found out that the log setting was set "info" level in setting.js

Info messages will include the node-red startup messages.

> [@piwi447](#):
>
> later at 6:20, i forced nodered to restart and got exactly same message on telegram

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

---

<div class="post-metadata">

**Author:** ![piwi447](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/piwi447/32/67335_2.png) [@piwi447](https://discourse.nodered.org/u/piwi447)\
**Post date:** [2 October 2022 12:54 UTC](https://discourse.nodered.org/t/node-red-restart-by-itself/68100/17 "2022-10-02T12:54:23Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [2 October 2022 13:12 UTC](https://discourse.nodered.org/t/node-red-restart-by-itself/68100/18 "2022-10-02T13:12:55Z")

</div>

> [@piwi447](#):
>
> Nodered is restarting sometimes by itself and I just try to understand what is the cause of this restart.

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.

---

<div class="post-metadata">

**Author:** ![piwi447](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/piwi447/32/67335_2.png) [@piwi447](https://discourse.nodered.org/u/piwi447)\
**Post date:** [3 October 2022 06:40 UTC](https://discourse.nodered.org/t/node-red-restart-by-itself/68100/19 "2022-10-03T06:40:21Z")

</div>

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)

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/2/4/24c924cf85151a3587d8cfb377bab626e8b9794a.png)

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

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [3 October 2022 07:12 UTC](https://discourse.nodered.org/t/node-red-restart-by-itself/68100/20 "2022-10-03T07:12:44Z")

</div>

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.

[Next page](https://discourse.nodered.org/t/node-red-restart-by-itself/68100.md?page=2)
