flatiron / union

A hybrid buffered / streaming middleware kernel backwards compatible with connect.

Home Page:http://github.com/flatiron/union

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Stream overwhelmed by `ResponseStream` causing memory leak

buptsb opened this issue · comments

https://github.com/flatiron/union/blob/master/lib/response-stream.js#L162

ResponseStream.prototype.write = function (data) {
  this.modified = true;

  if (this.writable) {
    this.emit('data', data);
  }
};

This function push data into destination streams, eg. HTTP response, without considering back pressure, it will blow the memory up when serving large static files.

Related issue: http-party/http-server#138

This module shouldn't be used anymore but will see if your patch fixes and still passes tests