Node red crash with javascript error

#1

Hello

I wrote the wrong javascript loop in a function, and this cause the complete node red to crash.

for ( i = 0 ; lista1.message.length ; i++) {
if(descript === lista1.message[i].ieeeAddr){
descript = lista1.message[i].friendly_name
}
}

13 Mar 19:45:43 - [info] Node-RED version: v0.20.0
13 Mar 19:45:43 - [info] Node.js version: v8.11.1
13 Mar 19:45:43 - [info] Linux 4.14.79-v7+ arm LE
13 Mar 19:45:47 - [info] Loading palette nodes

0 Likes

#2

You can start Node-RED with --safe flag. This allows you to fix your mistake before run your flow(s)

1 Like

#3

Cool... but shouldn´t this error be contained within the node?

0 Likes

#4

The node isn't able to contain this sort of programming error. You're loop will never exit due to the mistake in its exit clause.

Node.js is single threaded. If any bit of code goes into an infinite loop like this then the runtime will sit in that loop unable to do anything else. There is no mechanism to prevent it.

1 Like