Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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 · 4 comments

Comments

@ORESoftware
Copy link

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
Copy link
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
Copy link
Member

simov commented Oct 8, 2015

That fixes the issue idd, thanks for the help, @calibr 👍

@simov simov closed this as completed Oct 8, 2015
mxr576 added a commit to mxr576/webpage-content-extractor that referenced this issue Nov 14, 2015
@nraychaudhuri
Copy link

That fixes the issue. Thanks @calibr

@kevinburkenotion
Copy link

If you're coming to this from Google and cookie jars don't fix your issue (or you don't want them) read #3139 to figure out why this happened and how to fix it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants