Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Avoid 'EventEmitter memory leak' warnings.

Fixed problem: When a keep-alive connection has many requests, each request can result in a separate bounce, and all of those bounces getting piped back into the request stream can result in ugly warnings on stdout:
  (node) warning: possible EventEmitter memory leak detected. 11 listeners added. Use emitter.setMaxListeners() to increase limit.
  Trace:
      at Socket.<anonymous> (events.js:126:17)
      at Socket.pipe (stream.js:156:8)
      at /Users/seth/development/service/node_modules/bouncy/index.js:86:20
      at /Users/seth/development/service/scalar.js:52:5
      at IncomingMessage.onHeaders (/Users/seth/development/service/node_modules/bouncy/index.js:46:13)
      at IncomingMessage.emit (events.js:64:17)
      at Parser.<anonymous> (/Users/seth/development/service/node_modules/bouncy/node_modules/parsley/lib/modes.js:135:21)
      at Parser.execute (/Users/seth/development/service/node_modules/bouncy/node_modules/parsley/index.js:20:35)
      at Socket.<anonymous> (/Users/seth/development/service/node_modules/bouncy/node_modules/parsley/index.js:11:14)
      at Socket.emit (events.js:64:17)
  • Loading branch information...
commit 759e36595e67baed4a0c34902605662edf03e5a1 1 parent 72a51e2
@sethml sethml authored
Showing with 2 additions and 0 deletions.
  1. +2 −0  index.js
View
2  index.js
@@ -25,6 +25,8 @@ var bouncy = module.exports = function (opts, cb) {
var handler = bouncy.handler = function (cb, c) {
parsley(c, function (req) {
+ c.setMaxListeners(0);
+
var stream = new BufferedStream;
stream.pause();
Please sign in to comment.
Something went wrong with that request. Please try again.