Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Global Variable leak errno #20

Closed
devdazed opened this Issue Apr 9, 2012 · 7 comments

Comments

Projects
None yet
2 participants
Owner

devdazed commented Apr 9, 2012

the tests are reporting a global variable leak of the variable errno coming from the thift.js test file.

Owner

devdazed commented Apr 9, 2012

The value of errno when leaked is EOF

Contributor

ctavan commented Apr 12, 2012

This is a true mystery to me. Where does this variable even come from?

Owner

devdazed commented Apr 12, 2012

i have no idea, i've grepped the entire directory for it and it just doesn't exist, it may be made dynamically somewhere. I know its not just my box because travis-ci also reports the leak.

Owner

devdazed commented Apr 12, 2012

ok, the leak is apparent after the connection emits close:

  var helenus = require('helenus'),
      pool = new helenus.ConnectionPool({
        hosts      : ['localhost:9160'],
        keyspace   : 'test',
        timeout    : 3000
      });
  console.log('base-errno:', global.errno);

  pool.on('error', function(err){
    console.error(err.name, err.message);
    console.log('error-errno:', global.errno)
  });

  pool.on('close', function(){
    console.log('close-errno:', global.errno)
  });

  pool.connect(function(err, keyspace){
    if(err){
      throw(err);
    }
    console.log('connect-errno:', global.errno)

    keyspace.get('issue_20', function(err, cf){
      if(err){
        throw(err);
      }
      console.log('keyspace-errno:', global.errno)

      cf.insert('foo', {'bar':'baz'}, function(err){
        if(err){
          throw(err);
        }
        console.log('insert-errno:', global.errno)

        cf.get('foo', function(err, row){
          if(err){
            throw(err);
          }

          row.get('bar').value // => baz

          console.log('get-errno:', global.errno)

          pool.close()
        });
      });
    });
  });
Owner

devdazed commented Apr 12, 2012

Ok, I found the issue. It is actually a bug in the net module of node. I submitted an issue joyent/node#3095, so i will close this one.

@devdazed devdazed closed this Apr 12, 2012

Owner

devdazed commented Apr 12, 2012

As a side note, the only reason we haven't seen this before is that we never have opened and closed multiple connections until the new tests were written. So this problem has always existed, just never seen.

Contributor

ctavan commented Apr 12, 2012

Good to know! I've seen that a couple of times already but never dug so deep.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment