node-red / node-red/node-red-nodes

Node-red-node-arduino causing memory leaks on NodeJS v12.13.1

Open
#609 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
1.1k
Forks
612
Avg merge
13h 57m
Merged PRs (30d)
3

Description

Which node are you reporting an issue on?

Node-red-node-arduino

What are the steps to reproduce?

Enter into Raspberry Pi's terminal

What happens?

As node-red boots up, the memory leak warnings will appear, followed by an automated restart of node-red every time.

`Welcome to Node-RED

2 Dec 10:19:16 - [info] Node-RED version: v1.0.3
2 Dec 10:19:16 - [info] Node.js version: v12.13.1
2 Dec 10:19:16 - [info] Linux 4.19.75-v7l+ arm LE
2 Dec 10:19:16 - [info] Loading palette nodes
2 Dec 10:19:18 - [info] Dashboard version 2.18.0 started at /ui
2 Dec 10:19:18 - [info] Settings file : /home/pi/.node-red/settings.js
2 Dec 10:19:18 - [info] Context store : 'default' [module=memory]
2 Dec 10:19:18 - [info] User directory : /home/pi/.node-red
2 Dec 10:19:18 - [warn] Projects disabled : editorTheme.projects.enabled=false
2 Dec 10:19:18 - [info] Flows file : /home/pi/.node-red/flows_raspberrypi.json
2 Dec 10:19:18 - [info] Server now running at http://127.0.0.1:1880/
2 Dec 10:19:18 - [warn]

Your flow credentials file is encrypted using a system-generated key.
If the system-generated key is lost for any reason, your credentials
file will not be recoverable, you will have to delete it and re-enter
your credentials.
You should set your own key using the 'credentialSecret' option in
your settings file. Node-RED will then re-encrypt your credentials
file using your chosen key the next time you deploy a change.

2 Dec 10:19:18 - [info] Starting flows
2 Dec 10:19:18 - [info] Started flows
(node:2431) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 ready listeners added to [Firmata]. Use emitter.setMaxListeners() to increase limit
(node:2431) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 ready listeners added to [Firmata]. Use emitter.setMaxListeners() to increase limit
(node:2431) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 ready listeners added to [Firmata]. Use emitter.setMaxListeners() to increase limit
<--- Last few GCs --->
[2431:0x1fbc620] 119748 ms: Scavenge 253.9 (257.2) -> 252.5 (261.4) MB, 12.3 / 0.0 ms (average mu = 0.295, current mu = 0.287) allocation failure
[2431:0x1fbc620] 121826 ms: Mark-sweep 253.6 (261.4) -> 253.4 (255.9) MB, 1339.2 / 0.1 ms (+ 591.2 ms in 1272 steps since start of marking, biggest step 7.5 ms, walltime since start of marking 2078 ms) (average mu = 0.249, current mu = 0.194) finalize
<--- JS stacktrace --->
FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
nodered.service: Main process exited, code=killed, status=6/ABRT
nodered.service: Failed with result 'signal'.
nodered.service: Service RestartSec=100ms expired, scheduling restart.
nodered.service: Scheduled restart job, restart counter is at 10.
Stopped Node-RED graphical event wiring tool.
Started Node-RED graphical event wiring tool.`

What do you expect to happen?

I expect Node-red to boot up with no warnings and it doesn't crash.

Please tell us about your environment:
  • Node-RED version: v1.0.3
  • node.js version: v12.13.1
  • npm version: v6.12.1
  • Platform/OS: Linux 4.19.75-v7l+ arm LE / Rasbian OS
  • Browser: Chromium

Notes:
There were no more errors after I downgraded NodeJS to v10.17.0.
I made this post to just inform everyone that the Arduino module may not work with the latest version of NodeJS :)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the issue with node-red-start on a Raspberry Pi using Node.js v12.13.1, and compare the behavior with Node.js v10.17.0. The issue is resolved when Node-RED boots without MaxListeners warnings, heap exhaustion, or automated restarts.

Written by the indexing model from the issue text.

Assessment

Tech stack
arduino, javascript, nodejs, raspberry-pi
Domain
embedded-iot
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.