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

Already on GitHub? Sign in to your account

setMaxListeners(0) on reverseProxy to squelch warnings #400

wants to merge 13 commits into


None yet
6 participants

jcheng5 commented Apr 3, 2013

reverseProxy can have many subscribers to the 'drain' event when large
uploads occur. Without this fix I get the following warning printed in the log:

(node) warning: possible EventEmitter memory leak detected. 11 listeners added. Use emitter.setMaxListeners() to increase limit.
    at ClientRequest.EventEmitter.addListener (events.js:160:15)
    at ClientRequest.EventEmitter.once (events.js:179:8)
    at IncomingMessage.<anonymous> (/Users/jcheng/shiny-server-2/node_modules/http-proxy/lib/node-http-proxy/http-proxy.js:390:22)
    at IncomingMessage.EventEmitter.emit (events.js:117:20)
    at Object.resume (/Users/jcheng/shiny-server-2/node_modules/http-proxy/lib/node-http-proxy.js:253:18)
    at HttpProxy.proxyRequest (/Users/jcheng/shiny-server-2/node_modules/http-proxy/lib/node-http-proxy/http-proxy.js:428:16)
    at /Users/jcheng/shiny-server-2/lib/proxy/http.js:142:31
    at _fulfilled (/Users/jcheng/shiny-server-2/node_modules/q/q.js:830:54)
    at resolvedValue.promiseSend.done (/Users/jcheng/shiny-server-2/node_modules/q/q.js:860:30)
    at makePromise.promise.promiseSend (/Users/jcheng/shiny-server-2/node_modules/q/q.js:487:13)
@jcheng5 @jcheng5 jcheng5 + jcheng5 Allow unlimited listeners on reverseProxy
reverseProxy can have many subscribers to the 'drain' event when large
uploads occur.

indexzero commented Apr 21, 2013

This needs to be an option.

jcheng5 commented Apr 22, 2013

Could you elaborate on why? I didn't see a way for users to add their own listeners to reverseProxy; unless I missed something, there's no way the maxListeners warning on this particular object would help users catch a bug in their own code.

I have the same problem when uploading files with HTTP multipart/form-data. (about 2MB total) The patch is worked, thanks.

This problem should be solved by decreasing the event listeners, not free the limitation (even it's fastest solution..).


indexzero commented Dec 27, 2013

Needs to be broken out into several smaller pull-requests.

@indexzero indexzero closed this Dec 27, 2013

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