Node RED crashing because of Request body larger than maxBodyLength limit

#1

I have the following flow

mqtt in -> function node set http header -> http node (POST request)

Randomly after some time Node RED crashes, the following log is created:

12 Oct 15:05:36 - [error] [http request:20f2167a.d646e2] Error: Request body larger than maxBodyLength limit
12 Oct 15:05:54 - [error] [http request:20f2167a.d646e2] Error: Request body larger than maxBodyLength limit
12 Oct 15:05:59 - [error] [http request:20f2167a.d646e2] Error: Request body larger than maxBodyLength limit
12 Oct 15:06:11 - [error] [http request:20f2167a.d646e2] Error: Request body larger than maxBodyLength limit
12 Oct 15:15:35 - [error] [http request:20f2167a.d646e2] Error: Request body larger than maxBodyLength limit
12 Oct 15:15:38 - [error] [http request:20f2167a.d646e2] Error: Request body larger than maxBodyLength limit
12 Oct 15:15:48 - [error] [http request:20f2167a.d646e2] Error: Request body larger than maxBodyLength limit
12 Oct 15:16:12 - [error] [http request:20f2167a.d646e2] Error: Request body larger than maxBodyLength limit
12 Oct 15:16:19 - [error] [http request:20f2167a.d646e2] Error: Request body larger than maxBodyLength limit
12 Oct 15:16:26 - [error] [http request:20f2167a.d646e2] Error: Request body larger than maxBodyLength limit
12 Oct 15:26:51 - [error] [http request:20f2167a.d646e2] Error: Request body larger than maxBodyLength limit
12 Oct 15:26:55 - [error] [http request:20f2167a.d646e2] Error: Request body larger than maxBodyLength limit
12 Oct 15:26:59 - [error] [http request:20f2167a.d646e2] Error: Request body larger than maxBodyLength limit
12 Oct 15:27:16 - [error] [http request:20f2167a.d646e2] Error: Request body larger than maxBodyLength limit
12 Oct 15:27:23 - [error] [http request:20f2167a.d646e2] Error: Request body larger than maxBodyLength limit
12 Oct 15:27:30 - [error] [http request:20f2167a.d646e2] Error: Request body larger than maxBodyLength limit

<--- Last few GCs --->

[4881:0x33f4750] 2910604 ms: Mark-sweep 109.5 (121.5) -> 109.5 (121.5) MB, 52.9 / 0.0 ms allocation failure GC in old space requested
[4881:0x33f4750] 2910658 ms: Mark-sweep 109.5 (121.5) -> 109.4 (118.5) MB, 53.9 / 0.0 ms last resort GC in old space requested
[4881:0x33f4750] 2910712 ms: Mark-sweep 109.4 (118.5) -> 109.4 (118.5) MB, 53.8 / 0.0 ms last resort GC in old space requested

<--- JS stacktrace --->

==== JS stack trace =========================================

Security context: 0x238162625879
0: builtin exit frame: parse(this=0xe49a77589c1 ,0xd278f882201 <Very long string[45092283]>)

1: /* anonymous */ [evalmachine.<anonymous>:2] [bytecode=0xe49a7778499 offset=109](this=0x101daf4cd7d1 <JSGlobal Object>,msg=0x2d8226a97591 <Object map = 0x380cffc11611>)
2: /* anonymous */ [evalmachine.<anonymous>:17] [bytecode=0xe49a77781c1 offset=31](this=0x10...

Any suggestions? How can I prevent this to happen?

#2

Did you try a google search?

#3

I think google search is not the point.
Node RED/node should not crash because of a request body to large problem.

#4

If you do a google search it will lead you to information that will explain what is happening and how you can fix it.

I could tell you exactly what the solution is, but I choose to lead you in a direction where you can solve the issue yourself and gain some knowledge along the way and maybe next time you will be able to solve a problem yourself and then be able to help others.

#5

In fairness to OP, I tried doing several Google searches for this error and found nothing that I could apply to Node-RED

So I think in this case, a direct pointer to something that would help them would be appropriate :slight_smile:
Simon

#6

Try node-red maxBodyLength limit - third one on the list

#7

That is what is causing the first error messages, but is that why it is crashing, or has it run out of memory or something?

#8

Yes looks like the Garbage Collector has failed to collect enough and has indeed run out of memory. So yes... what machine is it one (how much memory). and how big are the objects being fetched, and how often ?