Skip to content

node-http-proxy leaks file descriptors #570

Closed
@jwalton

Description

@jwalton

Run this:

http = require('http');
httpProxy = require('http-proxy');

proxy = httpProxy.createProxyServer();
server = http.createServer(function(req, res) {
    return proxy.web(req, res, {
      target: 'http://example.com'
    });
});

server.listen(9000);
  • ps -ef | grep node to figure out the PID that's running it.
  • watch 'lsof -p 5966 | wc -l' (replace 5966 with your pid)
  • Point a browser at http://localhost:9000 (you'll get a 404 from example.com). I was using Chrome and FF.
  • Hit CTRL-R over and over.
  • Watch your open file count climb.

Sockets don't seem to close for 2 minutes. On OS/X, heavy traffic will run out of file descriptors very quickly (my product's Selenium test case kills node-http-proxy about 1/10th of the way through.)

Using node v0.10.25 and node-http-proxy 1.0.2.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions