Timer's `unref` unreliable when `http` module required after using them

Finally narrowed this down to a (admittedly bizarre) test case -- still looking into exactly why it happens -- but generally there appears to be a race condition or off-by-one in the timer unref management if the unref is called and then later the http module is required:

setImmediate(function () {
  require("http")
})

var i = setInterval(function () {
  setImmediate(process.exit)
}, 10)
i.unref()

process.on("exit", logstuff)

function logstuff() {
  console.log(process._getActiveHandles())
}

With 0.10 or 0.12 this logs [] which is expected because the interval was unreferenced.

In io.js you get:

[ { '0': [Function: listOnTimeout],
    _idleNext: 
     { _idleTimeout: 10,
       _idlePrev: [Circular],
       _idleNext: [Circular],
       _idleStart: 1218064360,
       _onTimeout: [Function: wrapper],
       _repeat: true,
       _handle: [Object] },
    _idlePrev: 
     { _idleTimeout: 10,
       _idlePrev: [Circular],
       _idleNext: [Circular],
       _idleStart: 1218064360,
       _onTimeout: [Function: wrapper],
       _repeat: true,
       _handle: [Object] },
    msecs: 10 } ]

Which is showing the unreferenced timer.

I found this when my application was supposed to be shutting down but was being kept alive by an unreferenced setInterval timer.