Node-RED Docker Containers - RAM Limitation

1,725 views
Skip to first unread message

Pedro Mendes

unread,
Jul 25, 2016, 7:42:19 AM7/25/16
to Node-RED
I've been using Node-RED through docker containers using my own image (https://hub.docker.com/r/homeit/node-red/), based on the official NodeJS image.

Since I run several small node-red apps on one host, I started limiting the container's RAM to 128 MB and specified --max_old_space_size=128 to set NodeJS garbage collection threshold.

I had a couple of server crashes, with the following log:

Jul 19 06:29:05 85c938a6-cbd0-439c-95d0-db671ca79175 kernel: [833953.214663] traps: node-red[19852] general protection ip:7fdba6568532 sp:7fff36f9c390 error:0 in libc-2.19.so[7fdba6532000+1a2000]
Jul 19 06:29:21 85c938a6-cbd0-439c-95d0-db671ca79175 kernel: [833969.170178] traps: node-red[3161] general protection ip:7f29b54eb532 sp:7ffd728830d0 error:0 in libc-2.19.so[7f29b54b5000+1a2000]

which I think are due to the --max_old_space_size=128 value which should be lower - I've now set it to 64mb and am waiting to see the results.

Today I came across the official Node-RED docker image (https://hub.docker.com/r/nodered/node-red-docker/) but found no mention of how to manage RAM limitations. Does anyone have any recommendation?

Thanks!

Nicholas O'Leary

unread,
Jul 25, 2016, 7:54:32 AM7/25/16
to Node-RED Mailing List
Hi Pedro - good question. That's something well need to look at.

The max old space size is the point where node will start garbage collecting - it is not a limit. So if the container is limited to 128MB, you need to set the value to something less to ensure the 128 limit of the container is not hit.

Nick

--
http://nodered.org
 
Join us on Slack to continue the conversation: http://nodered.org/slack
---
You received this message because you are subscribed to the Google Groups "Node-RED" group.
To unsubscribe from this group and stop receiving emails from it, send an email to node-red+u...@googlegroups.com.
To post to this group, send email to node...@googlegroups.com.
Visit this group at https://groups.google.com/group/node-red.
For more options, visit https://groups.google.com/d/optout.

James Thomas

unread,
Jul 25, 2016, 8:20:55 AM7/25/16
to Node-RED
I've opened a ticket for this request. 
https://github.com/node-red/node-red-docker/issues/4

We should support setting an environment variable, like NODE_OPTIONS, to allow this.

James Thomas

unread,
Jul 26, 2016, 10:42:04 AM7/26/16
to Node-RED
This has been implemented in https://github.com/node-red/node-red-docker/commit/82de544b50f5005c95e66fb115750a106e723168

Node.js runtime arguments can be passed to the container using an environment parameter (NODE_OPTIONS). For example, to fix the heap size used by the Node.js garbage collector you would use the following command.

    $ docker run -it -p 1880:1880 -e NODE_OPTIONS="--max_old_space_size=128" nodered/node-red-docker
Reply all
Reply to author
Forward
0 new messages