# Node-red crashes after startup

**URL:** <https://discourse.nodered.org/t/node-red-crashes-after-startup/52791>\
**Category:** General\
**Created:** [26 October 2021 22:02 UTC](https://discourse.nodered.org/t/node-red-crashes-after-startup/52791 "2021-10-26T22:02:21Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![tvan0076](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/tvan0076/32/34437_2.png) [@tvan0076](https://discourse.nodered.org/u/tvan0076)\
**Post date:** [26 October 2021 22:02 UTC](https://discourse.nodered.org/t/node-red-crashes-after-startup/52791/1 "2021-10-26T22:02:21Z")

</div>

I have found myself in an odd situation. Node-red crashes after starting up every minute. The only change I made was copy/paste all nodes from one flow to a new flow and deploy. I was able to delete the flow\<\>.json file and the server comes up fine. I moved all json data from a backup (2 days old) and restart the server and everything comes up fine. when I tried to C/P again and deploy the node-red crashes. In the end, I deleted some unused flows then tried C/P and everything is working. No issues with disk space, and plenty of CPU and Mem. Is there any setting in settings.json that I need to look at? Flow\_\<\>.json file is about 2.3MB (yes I have very large flows) Also, it worked fine if using node-red start (with all my flow data in startup.json).

---

<div class="post-metadata">

**Author:** ![hardillb](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hardillb/32/12373_2.png) [@hardillb](https://discourse.nodered.org/u/hardillb)\
**Post date:** [26 October 2021 22:11 UTC](https://discourse.nodered.org/t/node-red-crashes-after-startup/52791/2 "2021-10-26T22:11:02Z")

</div>

What is in there Node-RED log when it crashes?

---

<div class="post-metadata">

**Author:** ![tvan0076](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/tvan0076/32/34437_2.png) [@tvan0076](https://discourse.nodered.org/u/tvan0076)\
**Post date:** [26 October 2021 22:12 UTC](https://discourse.nodered.org/t/node-red-crashes-after-startup/52791/3 "2021-10-26T22:12:40Z")

</div>

I was not able to find the log file ☹ looked everywhere for it. I am running on centos.

---

<div class="post-metadata">

**Author:** ![hardillb](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hardillb/32/12373_2.png) [@hardillb](https://discourse.nodered.org/u/hardillb)\
**Post date:** [26 October 2021 22:14 UTC](https://discourse.nodered.org/t/node-red-crashes-after-startup/52791/4 "2021-10-26T22:14:56Z")

</div>

How are you starting Node-RED? And how did you install it?

Try running `node-red-log`

---

<div class="post-metadata">

**Author:** ![tvan0076](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/tvan0076/32/34437_2.png) [@tvan0076](https://discourse.nodered.org/u/tvan0076)\
**Post date:** [26 October 2021 22:18 UTC](https://discourse.nodered.org/t/node-red-crashes-after-startup/52791/5 "2021-10-26T22:18:38Z")

</div>

Node-Red starts with the OS from this install:

> **[GitHub - node-red/linux-installers: Node-RED install scripts for various...](https://github.com/node-red/linux-installers)**
>
> Node-RED install scripts for various flavours of Linux - GitHub - node-red/linux-installers: Node-RED install scripts for various flavours of Linux

Logs don't go back that far.

---

<div class="post-metadata">

**Author:** ![tvan0076](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/tvan0076/32/34437_2.png) [@tvan0076](https://discourse.nodered.org/u/tvan0076)\
**Post date:** [26 October 2021 22:25 UTC](https://discourse.nodered.org/t/node-red-crashes-after-startup/52791/6 "2021-10-26T22:25:55Z")

</div>

FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory

---

<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:** [27 October 2021 08:39 UTC](https://discourse.nodered.org/t/node-red-crashes-after-startup/52791/7 "2021-10-27T08:39:16Z")

</div>

Stop node red, then start it again using  
`node-red-start`  
Post the full log from startup to the crash. When posting the log use this technique: [How to share code or flow json](https://discourse.nodered.org/t/how-to-share-code-or-flow-json/506)

---

<div class="post-metadata">

**Author:** ![tvan0076](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/tvan0076/32/34437_2.png) [@tvan0076](https://discourse.nodered.org/u/tvan0076)\
**Post date:** [27 October 2021 14:51 UTC](https://discourse.nodered.org/t/node-red-crashes-after-startup/52791/8 "2021-10-27T14:51:50Z")

</div>

> [@tvan0076](#):
>
> JavaScript heap out of memory

```auto
27 Oct 09:48:03 - [info] [cronplus:First Day of the Month] createTask - index: 0, static: true, opt: {"name":"schedule1","topic":"schedule1","payloadType":"default","payload":"","expressionType":"cron","expression":"0 0 12 1 * *","location":"","offset":"0","solarType":"all","solarEvents":"sunrise,sunset"}
27 Oct 09:48:03 - [info] Started flows
<--- Last few GCs --->
[59627:0x523b7b0] 11130 ms: Mark-sweep 485.0 (521.0) -> 484.8 (521.0) MB, 484.6 / 0.1 ms (average mu = 0.149, current mu = 0.116) deserialize GC in old space requested
[59627:0x523b7b0] 11623 ms: Mark-sweep 485.0 (521.0) -> 484.9 (521.0) MB, 486.6 / 0.1 ms (average mu = 0.080, current mu = 0.014) deserialize GC in old space requested
<--- JS stacktrace --->
FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
 1: 0xa389b0 node::Abort() [node-red]
 2: 0x96e0af node::FatalError(char const*, char const*) [node-red]
 3: 0xbb7a4e v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [node-red]
 4: 0xbb7dc7 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [node-red]
 5: 0xd73fd5 [node-red]
 6: 0xd74b5f [node-red]
 7: 0xd8299b v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [node-red]
 8: 0xd85e1f v8::internal::Heap::ReserveSpace(std::vector<v8::internal::Heap::Chunk, std::allocator<v8::internal::Heap::Chunk> >*, std::vector<unsigned long, std::allocator<unsigned long> >*) [node-red]
 9: 0x110a9e2 v8::internal::DeserializerAllocator::ReserveSpace() [node-red]
10: 0x11084e6 v8::internal::ContextDeserializer::Deserialize(v8::internal::Isolate*, v8::internal::Handle<v8::internal::JSGlobalProxy>, v8::DeserializeInternalFieldsCallback) [node-red]
11: 0x1108d84 v8::internal::ContextDeserializer::DeserializeContext(v8::internal::Isolate*, v8::internal::SnapshotData const*, bool, v8::internal::Handle<v8::internal::JSGlobalProxy>, v8::DeserializeInternalFieldsCallback) [node-red]
12: 0x112f17a v8::internal::Snapshot::NewContextFromSnapshot(v8::internal::Isolate*, v8::internal::Handle<v8::internal::JSGlobalProxy>, unsigned long, v8::DeserializeInternalFieldsCallback) [node-red]
13: 0xe30388 v8::internal::Genesis::Genesis(v8::internal::Isolate*, v8::internal::MaybeHandle<v8::internal::JSGlobalProxy>, v8::Local<v8::ObjectTemplate>, unsigned long, v8::DeserializeInternalFieldsCallback, v8::MicrotaskQueue*) [node-red]
14: 0xe30738 v8::internal::Bootstrapper::CreateEnvironment(v8::internal::MaybeHandle<v8::internal::JSGlobalProxy>, v8::Local<v8::ObjectTemplate>, v8::ExtensionConfiguration*, unsigned long, v8::DeserializeInternalFieldsCallback, v8::MicrotaskQueue*) [node-red]
15: 0xbccf42 v8::NewContext(v8::Isolate*, v8::ExtensionConfiguration*, v8::MaybeLocal<v8::ObjectTemplate>, v8::MaybeLocal<v8::Value>, unsigned long, v8::DeserializeInternalFieldsCallback, v8::MicrotaskQueue*) [node-red]
16: 0xbcd694 v8::Context::New(v8::Isolate*, v8::ExtensionConfiguration*, v8::MaybeLocal<v8::ObjectTemplate>, v8::MaybeLocal<v8::Value>, v8::DeserializeInternalFieldsCallback, v8::MicrotaskQueue*) [node-red]
17: 0xa2953e node::contextify::ContextifyContext::CreateV8Context(node::Environment*, v8::Local<v8::Object>, node::contextify::ContextOptions const&) [node-red]
18: 0xa29b45 node::contextify::ContextifyContext::ContextifyContext(node::Environment*, v8::Local<v8::Object>, node::contextify::ContextOptions const&) [node-red]
19: 0xa29f26 node::contextify::ContextifyContext::MakeContext(v8::FunctionCallbackInfo<v8::Value> const&) [node-red]
20: 0x13ddced [node-red]
Process 59627 (node-red) of user 0 dumped core.
nodered.service: Main process exited, code=dumped, status=6/ABRT
nodered.service: Failed with result 'core-dump'.

```

---

<div class="post-metadata">

**Author:** ![tvan0076](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/tvan0076/32/34437_2.png) [@tvan0076](https://discourse.nodered.org/u/tvan0076)\
**Post date:** [27 October 2021 15:04 UTC](https://discourse.nodered.org/t/node-red-crashes-after-startup/52791/9 "2021-10-27T15:04:58Z")

</div>

```auto
top - 10:04:32 up 1 min, 1 user, load average: 1.23, 0.52, 0.19
Tasks: 331 total, 3 running, 328 sleeping, 0 stopped, 0 zombie
%Cpu(s): 4.7 us, 0.6 sy, 0.0 ni, 94.6 id, 0.0 wa, 0.1 hi, 0.0 si, 0.0 st
MiB Mem : 64150.2 total, 63286.3 free, 502.5 used, 361.3 buff/cache
MiB Swap: 8100.0 total, 8100.0 free, 0.0 used. 63041.5 avail Mem

```

---

<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:** [27 October 2021 15:16 UTC](https://discourse.nodered.org/t/node-red-crashes-after-startup/52791/10 "2021-10-27T15:16:16Z")

</div>

As I asked, please post the full startup log, from the start.

---

<div class="post-metadata">

**Author:** ![tvan0076](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/tvan0076/32/34437_2.png) [@tvan0076](https://discourse.nodered.org/u/tvan0076)\
**Post date:** [27 October 2021 15:21 UTC](https://discourse.nodered.org/t/node-red-crashes-after-startup/52791/11 "2021-10-27T15:21:32Z")

</div>

> [@tvan0076](#):
>
> `FatalError(char const*, char const*) [node-red]`

Is this better?

```auto
Stopped Node-RED graphical event wiring tool.
Started Node-RED graphical event wiring tool.
27 Oct 10:19:30 - [info]
Welcome to Node-RED
===================
27 Oct 10:19:30 - [info] Node-RED version: v2.1.3
27 Oct 10:19:30 - [info] Node.js version: v14.18.1
27 Oct 10:19:30 - [info] Linux 4.18.0-348.el8.x86_64 x64 LE
27 Oct 10:19:30 - [info] Loading palette nodes
27 Oct 10:19:31 - [info] Dashboard version 3.1.0 started at /ui
27 Oct 10:19:32 - [info] Settings file : /root/.node-red/settings.js
27 Oct 10:19:32 - [info] Context store : 'default' [module=memory]
27 Oct 10:19:32 - [info] User directory : /root/.node-red
27 Oct 10:19:32 - [warn] Projects disabled : editorTheme.projects.enabled=false
27 Oct 10:19:32 - [info] Flows file : /root/.node-red/flows_DFW-01.json
27 Oct 10:19:32 - [info] Server now running at http://127.0.0.1:1880/
27 Oct 10:19:32 - [warn]
---------------------------------------------------------------------
Your flow credentials file is encrypted using a system-generated key.
If the system-generated key is lost for any reason, your credentials
file will not be recoverable, you will have to delete it and re-enter
your credentials.
You should set your own key using the 'credentialSecret' option in
your settings file. Node-RED will then re-encrypt your credentials
file using your chosen key the next time you deploy a change.
---------------------------------------------------------------------
27 Oct 10:19:32 - [info] Starting flows
27 Oct 10:19:34 - [info] [cronplus:First Day of the Month] createTask - index: 0, static: true, opt: {"name":"schedule1","topic":"schedule1","payloadType":"default","payload":"","expressionType":"cron","expression":"0 0 12 1 * *","location":"","offset":"0","solarType":"all","solarEvents":"sunrise,sunset"}
27 Oct 10:19:34 - [info] Started flows
<--- Last few GCs --->
[3258:0x4e187b0] 10729 ms: Mark-sweep 486.0 (529.3) -> 485.7 (529.5) MB, 486.5 / 0.1 ms (average mu = 0.113, current mu = 0.015) deserialize GC in old space requested
[3258:0x4e187b0] 11225 ms: Mark-sweep 486.0 (529.5) -> 485.9 (529.8) MB, 488.6 / 0.1 ms (average mu = 0.065, current mu = 0.015) deserialize GC in old space requested
<--- JS stacktrace --->
FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
 1: 0xa389b0 node::Abort() [node-red]
 2: 0x96e0af node::FatalError(char const*, char const*) [node-red]
 3: 0xbb7a4e v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [node-red]
 4: 0xbb7dc7 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [node-red]
 5: 0xd73fd5 [node-red]
 6: 0xd74b5f [node-red]
 7: 0xd8299b v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [node-red]
 8: 0xd85de7 v8::internal::Heap::ReserveSpace(std::vector<v8::internal::Heap::Chunk, std::allocator<v8::internal::Heap::Chunk> >*, std::vector<unsigned long, std::allocator<unsigned long> >*) [node-red]
 9: 0x110a9e2 v8::internal::DeserializerAllocator::ReserveSpace() [node-red]
10: 0x11084e6 v8::internal::ContextDeserializer::Deserialize(v8::internal::Isolate*, v8::internal::Handle<v8::internal::JSGlobalProxy>, v8::DeserializeInternalFieldsCallback) [node-red]
11: 0x1108d84 v8::internal::ContextDeserializer::DeserializeContext(v8::internal::Isolate*, v8::internal::SnapshotData const*, bool, v8::internal::Handle<v8::internal::JSGlobalProxy>, v8::DeserializeInternalFieldsCallback) [node-red]
12: 0x112f17a v8::internal::Snapshot::NewContextFromSnapshot(v8::internal::Isolate*, v8::internal::Handle<v8::internal::JSGlobalProxy>, unsigned long, v8::DeserializeInternalFieldsCallback) [node-red]
13: 0xe30388 v8::internal::Genesis::Genesis(v8::internal::Isolate*, v8::internal::MaybeHandle<v8::internal::JSGlobalProxy>, v8::Local<v8::ObjectTemplate>, unsigned long, v8::DeserializeInternalFieldsCallback, v8::MicrotaskQueue*) [node-red]
14: 0xe30738 v8::internal::Bootstrapper::CreateEnvironment(v8::internal::MaybeHandle<v8::internal::JSGlobalProxy>, v8::Local<v8::ObjectTemplate>, v8::ExtensionConfiguration*, unsigned long, v8::DeserializeInternalFieldsCallback, v8::MicrotaskQueue*) [node-red]
15: 0xbccf42 v8::NewContext(v8::Isolate*, v8::ExtensionConfiguration*, v8::MaybeLocal<v8::ObjectTemplate>, v8::MaybeLocal<v8::Value>, unsigned long, v8::DeserializeInternalFieldsCallback, v8::MicrotaskQueue*) [node-red]
16: 0xbcd694 v8::Context::New(v8::Isolate*, v8::ExtensionConfiguration*, v8::MaybeLocal<v8::ObjectTemplate>, v8::MaybeLocal<v8::Value>, v8::DeserializeInternalFieldsCallback, v8::MicrotaskQueue*) [node-red]
17: 0xa2953e node::contextify::ContextifyContext::CreateV8Context(node::Environment*, v8::Local<v8::Object>, node::contextify::ContextOptions const&) [node-red]
18: 0xa29b45 node::contextify::ContextifyContext::ContextifyContext(node::Environment*, v8::Local<v8::Object>, node::contextify::ContextOptions const&) [node-red]
19: 0xa29f26 node::contextify::ContextifyContext::MakeContext(v8::FunctionCallbackInfo<v8::Value> const&) [node-red]
20: 0x13ddced [node-red]
Process 3258 (node-red) of user 0 dumped core.
nodered.service: Main process exited, code=dumped, status=6/ABRT
nodered.service: Failed with result 'core-dump'.

```

---

<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:** [27 October 2021 15:25 UTC](https://discourse.nodered.org/t/node-red-crashes-after-startup/52791/12 "2021-10-27T15:25:54Z")

</div>

OK, so nodejs is running out of memory. Are you doing something with large buffers or large files, images, video etc?

During the minute before it crashes is node red using a lot of CPU? If so then likely you have some sort of loop somewhere, which is allocating memory and never releasing it.

---

<div class="post-metadata">

**Author:** ![tvan0076](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/tvan0076/32/34437_2.png) [@tvan0076](https://discourse.nodered.org/u/tvan0076)\
**Post date:** [27 October 2021 15:33 UTC](https://discourse.nodered.org/t/node-red-crashes-after-startup/52791/13 "2021-10-27T15:33:48Z")

</div>

No, I don't use large files, videos, or large buffers. Each flow does check an email account every 10 minutes for new emails, but the emails are HTML/text only. CPU does go crazy right before crashing. What I don't understand is why it starts fine if I remove one or two of the flows.

---

<div class="post-metadata">

**Author:** ![tvan0076](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/tvan0076/32/34437_2.png) [@tvan0076](https://discourse.nodered.org/u/tvan0076)\
**Post date:** [27 October 2021 15:49 UTC](https://discourse.nodered.org/t/node-red-crashes-after-startup/52791/14 "2021-10-27T15:49:21Z")

</div>

All,  
I was able to start Node-Red with this:

node-red-start --node-args="--max-old-space-size=3072" -- -v

Now, my next question is how to make this permanent when the server reboots and auto-starts Node-Red.

---

<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:** [27 October 2021 15:53 UTC](https://discourse.nodered.org/t/node-red-crashes-after-startup/52791/15 "2021-10-27T15:53:28Z")

</div>

> [@tvan0076](#):
>
> CPU does go crazy right before crashing

Probably you have a loop somewhere that gets triggered occasionally. It must be to do with the flows you are adding. Add some debug about and watch for it anything strange.

---

<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:** [27 October 2021 15:56 UTC](https://discourse.nodered.org/t/node-red-crashes-after-startup/52791/16 "2021-10-27T15:56:14Z")

</div>

> [@tvan0076](#):
>
> node-red-start --node-args="--max-old-space-size=3072" -- -v

I suspect that you are just hiding the issue temporarily and that it will recur.

You can edit the startup in the systemd script. this command will show you where it is (at least it does on Debian systems, I don't know whether yours is the same)  
`systemctl status nodered`

---

<div class="post-metadata">

**Author:** ![tvan0076](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/tvan0076/32/34437_2.png) [@tvan0076](https://discourse.nodered.org/u/tvan0076)\
**Post date:** [27 October 2021 16:28 UTC](https://discourse.nodered.org/t/node-red-crashes-after-startup/52791/17 "2021-10-27T16:28:31Z")

</div>

I am back in business! Thanks all!!

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [10 November 2021 16:29 UTC](https://discourse.nodered.org/t/node-red-crashes-after-startup/52791/18 "2021-11-10T16:29:15Z")

</div>

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