0
var connect = require('connect'),
    app = connect();
    app.use(connectRoute(function (router) {
        router.get('/', function (req, res, next) {
            callFun(res);
            })
            }))
 app.listen(port);

/** callFun **/
function callFun(res) {
var http = require('http');
var req = http.request(options, function(response) {
  response.on('data', function (chunk) {
    res.end(chunk);
  });
});

}

When Im trying to run the above code using nodeload

./nl.js -c 1 -n 10 -i 1 http://localhost:1000/

I get the below warning

    (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:663:33)
        at ClientRequest.<anonymous> (http.js:2069:7)
        at ClientRequest.EventEmitter.emit (events.js:117:20)
        at http.js:1710:9
        at process._tickCallback (node.js:415:13)

How can I resolve this issue?
Any help on this will be really helpful. Thanks

user87267867
  • 1,409
  • 3
  • 18
  • 25

1 Answers1

0

That warning is generated by nodeload, not by your app.

I'm also getting other warnings when running nodeload:

http.createClient is deprecated. Use `http.request` instead.

I'm guessing it's fair to assume that nodeload has reached EOL, perhaps you should start looking for a replacement (I like flod). Or just take the warning for granted, since nodeload still appears to work just fine.

robertklep
  • 198,204
  • 35
  • 394
  • 381
  • So nodeload warning can be ignored. Will it affect the performance of the server depending on the number of requests? – user87267867 Oct 09 '13 at 07:02
  • @user87267867 I don't think it will, I tried running `nl.js` with 500 concurrent connections and 1000 requests, and apart from the warning I got it seemed to work just fine – robertklep Oct 09 '13 at 07:21