Node Red dead after infinite recursive loop

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 :stuck_out_tongue:

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

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

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

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

node-red --safe

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

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... :frowning: )

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... :frowning: )

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

Thank you everyone :slight_smile:

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

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

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 :stuck_out_tongue:

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

image

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