T
T
Toster_KSL2016-08-29 19:32:46
Node.js
Toster_KSL, 2016-08-29 19:32:46

How to prevent Node.js from shutting down due to low memory?

Due to lack of memory, the process I need is disabled
In the log

[2016-08-28 11:12:16] [ERROR] (node) warning: possible EventEmitter memory leak detected. 11 off listeners added. Use emitter.setMaxListeners() to increase limit.
[2016-08-28 11:12:16] [ERROR] Trace
    at addListener (events.js:239:17)
    at Scales.powerOn (/srv/scales/lib/process.js:399:10)
    at Async.series.startup (/srv/scales/lib/process.js:213:18)
    at /srv/scales/node_modules/async/lib/async.js:718:13
    at iterate (/srv/scales/node_modules/async/lib/async.js:262:13)
    at /srv/scales/node_modules/async/lib/async.js:274:29
    at /srv/scales/node_modules/async/lib/async.js:44:16
    at /srv/scales/node_modules/async/lib/async.js:723:17
    at /srv/scales/node_modules/async/lib/async.js:167:37
    at /srv/scales/lib/plugins/minecraft/main.js:111:28

How can this be avoided in the future?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Andrey Inishev, 2016-08-29
@inish777

https://github.com/foreverjs/forever + look for a bug in the code + the node directly suggests the option with "Use emitter.setMaxListeners() to increase limit."

M
Michael, 2016-08-29
@id194695811

Try like this
Retrieved from stackoverflow.com/a/38947078/5526354

Y
yeti357, 2016-09-01
@yeti357

First of all, make sure that listeners do not breed in a cycle or when creating an object / request on a regular basis. When deleting an object/request that hung a listener, don't forget to remove the added callback from the emitter event using removelistener
, set only the used emitter event instance to an increased limit on listeners.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question