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

Closed
ORESoftware opened this Issue Oct 2, 2015 · 3 comments

Projects

None yet

4 participants

@ORESoftware

I have this code:

request('http://www.nytimes.com/2015/10/04/upshot/soda-industry-struggles-as-consumer-tastes-change.html', function (err, resp, body) {

    if (err) {
        console.error(err);
    }

});

if get this error:

(node) warning: possible EventEmitter memory leak detected. 11 pipe listeners added. Use emitter.setMaxListeners() to increase limit.
Trace
    at Request.addListener (events.js:179:15)
    at Request.init (/Users/amills001c/WebstormProjects/underscore/alleyoop/node_modules/request/request.js:496:8)
    at Redirect.onResponse (/Users/amills001c/WebstormProjects/underscore/alleyoop/node_modules/request/lib/redirect.js:149:11)
    at Request.onRequestResponse (/Users/amills001c/WebstormProjects/underscore/alleyoop/node_modules/request/request.js:944:22)
    at ClientRequest.emit (events.js:107:17)
    at HTTPParser.parserOnIncomingClient [as onIncoming] (_http_client.js:426:21)
    at HTTPParser.parserOnHeadersComplete (_http_common.js:111:23)
    at Socket.socketOnData (_http_client.js:317:20)
    at Socket.emit (events.js:107:17)
    at readableAddChunk (_stream_readable.js:163:16)
(node) warning: possible EventEmitter memory leak detected. 11 end listeners added. Use emitter.setMaxListeners() to increase limit.
Trace
    at Request.addListener (events.js:179:15)
    at Request.start (/Users/amills001c/WebstormProjects/underscore/alleyoop/node_modules/request/request.js:843:8)
    at Request.end (/Users/amills001c/WebstormProjects/underscore/alleyoop/node_modules/request/request.js:1394:10)
    at end (/Users/amills001c/WebstormProjects/underscore/alleyoop/node_modules/request/request.js:564:14)
    at Immediate._onImmediate (/Users/amills001c/WebstormProjects/underscore/alleyoop/node_modules/request/request.js:578:7)
    at processImmediate [as _immediateCallback] (timers.js:367:17)
[Error: Exceeded maxRedirects. Probably stuck in a redirect loop http://www.nytimes.com/2015/10/04/upshot/soda-industry-struggles-as-consumer-tastes-change.html?_r=4]

I don't see a redirect loop, so any idea what it could be? thanks

@calibr
Contributor
calibr commented Oct 2, 2015

It seems that nytimes.com generates infinite loop of redirects with cookies disabled, so you need to enable them when make the request:

request({
  url: 'http://www.nytimes.com/2015/10/04/upshot/soda-industry-struggles-as-consumer-tastes-change.html',
  jar: true
}, function (err, resp, body) {

});
@simov
Member
simov commented Oct 8, 2015

That fixes the issue idd, thanks for the help, @calibr ๐Ÿ‘

@simov simov closed this Oct 8, 2015
@mxr576 mxr576 added a commit to mxr576/webpage-content-extractor that referenced this issue Nov 14, 2015
@mxr576 mxr576 Fix issues with http://www.nytimes.com. 20e2187
@nraychaudhuri

That fixes the issue. Thanks @calibr

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment