Happygolucky
Happygolucky

Reputation: 111

(node) warning: possible EventEmitter memory leak detected. 11 listeners added. Use emitter.setMaxListeners() to increase limit

I am a newbie to Nodjs. setMaxListeners(0) didnt work for me. I get this error on subsequent connections to the database (mysql). All I have in my code is:

var http= require(), etc;
http.createServer(
function (req, res) { ... }).listen(8888);

There are many switch cases within the function with forms being submitted & sql queries executed between the different switch cases

Upvotes: 0

Views: 1235

Answers (1)

JB Smith
JB Smith

Reputation: 31

Without seeing some code first, you might just take a look to see if you are using enter .on handlers instead of .once handlers.

If you are creating many .on event handlers, they may not be released once execution of the request/response cycle stops.

Try converting some or most of your .on handlers to use .once instead, and see how it goes.

Upvotes: 3

Related Questions