Http request kills node-red

Hi,
I am running node-red on my raspberry pi 3.
recently I upgraded to v0.20.3 and now one of my flows does not work anymore.
The flow consists of many HTTP requests to different APIs (with the goal to normalize the data I get from these calls and just get one single json response)
Since today, every time I do an http request to the http-in node it goes through all the steps of sending http requests to the APIs and it will even answer with the proper JSON response BUT the blue dot below the last request and the text 'requesting' will not go away and cause the node-red server to crash:

nodered.service: Main process exited, code=killed, status=6/ABRT
nodered.service: Unit entered failed state.
nodered.service: Failed with result 'signal'.
nodered.service: Service hold-off time over, scheduling restart.
Stopped Node-RED graphical event wiring tool.
Started Node-RED graphical event wiring tool.

After that the server restarts and is working again.

I like to mention that I am using nested http requests for this: I have an http request to localhost within another http request which is performing a few http requests to other hosts and then generating a json response. If I only perform the nested http request locally it will work without any problems.
Unfortunately I can not post the flow here as it contains a lot of API keys.

Has anybody ever encountered behaviour like this? I looked for a solution for hours now, but I think that this may be just be a bug in the new version of node-red?

Any help is greatly appreciated!

Have a look in the node-red log. You can see this using the command node-red-log, or by running

node-red-stop
node-red-start

Copy/paste the result of that here if necessary.

Thank you for your answer.

I set the logging level to 'trace' but it will not log anything related to this issue. When I perform the request it will work perfectly (once) but then the node-red server is dead for ~30-60 seconds until I received the messages mentioned above after which it automatically restarts.

The last http request will succeed and even pass the result on to the next node but the blue box and the 'requesting' won't go away for some reason.


This is not related to the request itself. I changed the order of the requests a few times already and it is always the last request that dies...

what version of nodejs?

v8.11.1
Should I upgrade?

if you are on v8 you shouldn’t need to.

1 Like

Can you post the log from the welcome message through to when it restarts and shows the welcome again please. Copy/paste it from the terminal. There may be something there that is relevant even though you think not.

1 Like

I think you are right Colin!

I missed this part of the error before:

<--- Last few GCs --->
[3725:0x35f0908] 57742 ms: Mark-sweep 253.5 (265.2) -> 253.0 (265.7) MB, 1617.7 / 0.0 ms (average mu = 0.091, current mu = 0.007) allocation failure scavenge might not succeed
[3725:0x35f0908] 61835 ms: Mark-sweep 253.7 (265.7) -> 253.3 (265.7) MB, 4081.8 / 0.0 ms (average mu = 0.028, current mu = 0.003) allocation failure scavenge might not succeed
<--- JS stacktrace --->
==== JS stack trace =========================================
0: ExitFrame [pc: 0x35fdf0bc]
1: StubFrame [pc: 0x35fe02a8]
Security context: 0x45812055
2: /* anonymous / [0x28649291] [Function node:af53406d.cf5ce [create DB topics]:~1] [pc=0x330658b0](this=0x222b1129 ,0x286492cd )
3: /
anonymous */ [0x344b29c9] [Function node:af53406d.cf5ce [create DB topics]:71] [bytecode=0x5bf72f81 offset=31](this=0x4720e559 )
...
FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
Writing Node.js report to file: report.20190327.150207.3725.001.json
Node.js report completed
nodered.service: Main process exited, code=killed, status=6/ABRT
nodered.service: Unit entered failed state.
nodered.service: Failed with result 'signal'.
nodered.service: Service hold-off time over, scheduling restart.
Stopped Node-RED graphical event wiring tool.
Started Node-RED graphical event wiring tool.

It seems that there is some error in the 'create DB topics' function which is a node that is called later in the flow.
Update: I found it. There was a logic error inside of that function that caused an infinite loop.
So all of this had nothing to do with the HTTP requests, it was just not clear to me that the error came from that function.
Thanks for your help!

Glad to be of help.

2 Likes