Memory leak #39

Closed
thejh opened this Issue Jun 24, 2011 · 4 comments

Comments

Projects
None yet
2 participants
@thejh
Contributor

thejh commented Jun 24, 2011

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

This comment has been minimized.

Show comment Hide comment
@mikeal

mikeal Jul 21, 2011

Member

what is ./index.js?

Member

mikeal commented Jul 21, 2011

what is ./index.js?

@mikeal

This comment has been minimized.

Show comment Hide comment
@mikeal

mikeal Jul 21, 2011

Member

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

Member

mikeal commented Jul 21, 2011

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

@mikeal mikeal closed this Jul 21, 2011

@thejh

This comment has been minimized.

Show comment Hide comment
@thejh

thejh Jul 22, 2011

Contributor

I'll try to get more info soon.

Contributor

thejh commented Jul 22, 2011

I'll try to get more info soon.

@thejh

This comment has been minimized.

Show comment Hide comment
@thejh

thejh Jul 22, 2011

Contributor

Oh, sorry, seems like I was mistaken.

Contributor

thejh commented Jul 22, 2011

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