# Node Red dead after infinite recursive loop

**URL:** <https://discourse.nodered.org/t/node-red-dead-after-infinite-recursive-loop/60197>\
**Category:** General\
**Created:** [22 March 2022 14:33 UTC](https://discourse.nodered.org/t/node-red-dead-after-infinite-recursive-loop/60197 "2022-03-22T14:33:55Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tassidar](https://avatars.discourse-cdn.com/v4/letter/t/e99b99/32.png) [@Tassidar](https://discourse.nodered.org/u/Tassidar)\
**Post date:** [22 March 2022 14:33 UTC](https://discourse.nodered.org/t/node-red-dead-after-infinite-recursive-loop/60197/1 "2022-03-22T14:33:55Z")

</div>

Hi Everyone,

this is my first post. I've been using Node Red for a while and I'm quite happy with it.

Since it was lots of fun and no real problems, I didn't need to ask for help... until now 😛

Today I accidentally started an infinite recursion of an external Python-Script. (via exec-Node...)

Well, infinite was a little too much for my poor ol' Pi4 with just 2 GB, and so I crashed Node-Red.

I figured, that when I move the Script somewhere else and restart my PI, that everything would come back to life, but no. ☹

Do you have any Idea how to revive it?

Here is a snippet of log, that node-red gives me, when I run it manually (did do a proper "sudo service nodered stop" before...

```auto
Welcome to Node-RED
===================

22 Mar 14:41:19 - [info] Node-RED version: v2.2.2
22 Mar 14:41:19 - [info] Node.js version: v14.19.1
22 Mar 14:41:19 - [info] Linux 5.10.103-v8+ arm64 LE
22 Mar 14:41:20 - [info] Loading palette nodes
22 Mar 14:41:21 - [info] Dashboard version 3.1.6 started at /ui
22 Mar 14:41:22 - [info] Settings file : /home/pi/.node-red/settings.js
22 Mar 14:41:22 - [info] Context store : 'default' [module=memory]
22 Mar 14:41:22 - [info] User directory : /home/pi/.node-red
22 Mar 14:41:22 - [info] Projects directory: /home/pi/.node-red/projects
22 Mar 14:41:22 - [info] Server now running at http://127.0.0.1:1880/
22 Mar 14:41:22 - [info] Active project : Sonne
22 Mar 14:41:22 - [info] Flows file : /home/pi/.node-red/projects/Sonne/flow.json
22 Mar 14:41:22 - [info] Starting flows
22 Mar 14:41:22 - [info] Started flows
22 Mar 14:41:22 - [info] [mqtt-broker:9ccb1d4ebcf2234b] Connection failed to broker: mqtt://localhost:1883

<--- Last few GCs --->

[1180:0x17438910] 47202 ms: Scavenge (reduce) 922.8 (928.2) -> 922.2 (929.0) MB, 4.9 / 0.0 ms (average mu = 0.213, current mu = 0.153) allocation failure 
[1180:0x17438910] 52460 ms: Mark-sweep (reduce) 923.0 (926.0) -> 922.1 (926.7) MB, 5249.6 / 0.1 ms (+ 2.2 ms in 265 steps since start of marking, biggest step 0.0 ms, walltime since start of marking 5507 ms) (average mu = 0.123, current mu = 0.072) al

<--- JS stacktrace --->

FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
 1: 0xa2f1a8 node::Abort() [node-red]
 2: 0x975a58 node::FatalError(char const*, char const*) [node-red]
 3: 0xb947e0 v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [node-red]
 4: 0xb9496c v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [node-red]
 5: 0xd3d088 v8::internal::Heap::EnsureFromSpaceIsCommitted() [node-red]
 6: 0xd3daf0 [node-red]
 7: 0xd4b7b4 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [node-red]
 8: 0xd4ec84 v8::internal::Heap::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [node-red]
 9: 0xd20f74 v8::internal::Factory::NewFillerObject(int, bool, v8::internal::AllocationType, v8::internal::AllocationOrigin) [node-red]
10: 0x103c1ec v8::internal::Runtime_AllocateInYoungGeneration(int, unsigned long*, v8::internal::Isolate*) [node-red]
11: 0x139e98c [node-red]
Aborted

```

Thanks alot.

All the best

- Thorsten

---

<div class="post-metadata">

**Author:** ![ghayne](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ghayne/32/39_2.png) [@ghayne](https://discourse.nodered.org/u/ghayne)\
**Post date:** [22 March 2022 14:41 UTC](https://discourse.nodered.org/t/node-red-dead-after-infinite-recursive-loop/60197/2 "2022-03-22T14:41:06Z")

</div>

If you can stop node red, then re-start with

```auto
node-red --safe

```

it will start with no flows running, you can then edit the offending code.

---

<div class="post-metadata">

**Author:** ![Tassidar](https://avatars.discourse-cdn.com/v4/letter/t/e99b99/32.png) [@Tassidar](https://discourse.nodered.org/u/Tassidar)\
**Post date:** [22 March 2022 14:41 UTC](https://discourse.nodered.org/t/node-red-dead-after-infinite-recursive-loop/60197/3 "2022-03-22T14:41:23Z")

</div>

Hi Colin, thank you for your reply:

> Welcome to the forum @Tassidar
> 
> Generally it is best to start a new thread rather than replying to an old one, unless you believe that the cause is the same as the previous thread. I will ask some questions, if you could start a new thread, and provide the answers to those questions, as well as the information you posted, then that would be best.
> 
> Does it fail very soon after the mqtt broker message or is it some time later?
> 
> Was it working ok and then failed? If so then did you change anything?
> 
> Should it connect to the mqtt broker ok?

MQTT is innocent. I did shut it down before I started Node Red manually.

(I also shut down influxd and grafana... I was hoping, that that might help, but no... ☹ )

So when I leave mosquitto, influx and grafana alive, the same thing happens.

I'm quite sure that everything was perfect, until I accidentally started that recursive loop in Node Red.

Now that I think of it... My thought was, that moving the external Python-Script would prevent bad things from happening... But maybe that is not the case. If I build a recursion in Node Red and the exec-Node in the middle is calling a non-existent python-script, then maybe it just continues? That would explain, why Node-Red is still dying right after starting it. (with no chance of interaction... ☹ )

So yeah... Autostart-Node together with recursion is a bad idea, I learned today 😛

Thank you everyone 🙂

---

<div class="post-metadata">

**Author:** ![Tassidar](https://avatars.discourse-cdn.com/v4/letter/t/e99b99/32.png) [@Tassidar](https://discourse.nodered.org/u/Tassidar)\
**Post date:** [22 March 2022 14:42 UTC](https://discourse.nodered.org/t/node-red-dead-after-infinite-recursive-loop/60197/4 "2022-03-22T14:42:06Z")

</div>

Sweet! Will try it right away! I'm sure that that is exactly what I am looking for. 😃

---

<div class="post-metadata">

**Author:** ![Tassidar](https://avatars.discourse-cdn.com/v4/letter/t/e99b99/32.png) [@Tassidar](https://discourse.nodered.org/u/Tassidar)\
**Post date:** [22 March 2022 14:48 UTC](https://discourse.nodered.org/t/node-red-dead-after-infinite-recursive-loop/60197/5 "2022-03-22T14:48:42Z")

</div>

First off, YES, Thank you! Node-Red is back! 😃

Second... I found the foul-node right away. Apparently I left it in the middle of editing it and at that point there was no increment in the loop... so... yeah... not a good idea 😛

So as a warning to- and negative example for everyone - Don't do that:

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/b/a/ba749ec47e12c149e0869f2141969dffb33feebe.png)

---

<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:** [5 April 2022 14:49 UTC](https://discourse.nodered.org/t/node-red-dead-after-infinite-recursive-loop/60197/6 "2022-04-05T14:49:33Z")

</div>

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