0

I'm trying to do concurrent hits to my node server and am getting the below error

node) warning: possible EventEmitter memory leak detected. 11 listeners added. Use emitter.setMaxListeners() to increase limit. Trace at Socket.EventEmitter.addListener (events.js:160:15) at Socket.Readable.on (_stream_readable.js:689:33) at ClientRequest. (/home/ubuntu/sample.js:20:24) at ClientRequest.EventEmitter.emit (events.js:117:20) at http.js:1759:9 at process._tickDomainCallback (node.js:459:13)

even though i set setMaxListeners() and installed the version of node (where they said that this bug has been fixed) still there is not effect.Somewhere memory is being piled up.

Below is the place where the above error is occuring

socket.on('timeout', function () {
    request.abort();
                });

How can I stop this EventEmitter memory leak issue from happening?

Stack s
  • 113
  • 2
  • 2
  • 12
  • Could you show your code, please? – Ry- Jul 01 '15 at 05:47
  • @minitech : This is where i'm getting tne error socket.on('timeout', function () { request.abort(); }); – Stack s Jul 03 '15 at 05:43
  • Could you show your *entire* code, please? Or better, a minimal case that can reproduce the problem? – Ry- Jul 03 '15 at 05:49
  • Though i have not tried socket much, but ` 11 listeners added` gives me a hint that you might be registering multiple socket listener. As number of socket connection will increase, this problem may become more visible. How about keeping single listener for all socket. – Gaurav Gupta Jul 03 '15 at 05:56

0 Answers0