Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Memory leak #39

Closed
thejh opened this Issue · 4 comments

2 participants

@thejh

Hello,
the following code seems to leak (although I'm not sure it's because of your module, maybe the problem is in the core). Below are by attempts to find the cause (however, I didn't find it, but maybe it will help you).

var request = require('request');
var assertVanish = require('./index');

var test = function() {
  var callback = function (error, response, body) {
    if (!error && response.statusCode == 200) {
      console.error("request ok");
    } else {
      console.error("ERROR");
    }
  }
  assertVanish(callback, 10000);
  request({uri:'http://www.google.com'}, callback);
}

test();

Here are the first two hundred lines of a tree that shows why things can't be garbage collected: https://gist.github.com/1044647
Here are most natively-referenced objects (ones that can't get garbage collected although there are no references to them): https://gist.github.com/1044651

Although the network socket got closed (according to lsof) and an answer came in, there are ServerResponse and Agent objects that, in some way, reference the callback provided to request. Doesn't seem right...

Here is the extracted cause for the first encountered natively-referenced thing: https://gist.github.com/1044683

@mikeal
Owner

what is ./index.js?

@mikeal
Owner

I don't have enough information to debug this. closing for now.

@mikeal mikeal closed this
@thejh

I'll try to get more info soon.

@thejh

Oh, sorry, seems like I was mistaken.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.