joyent/node — Issue #1877: Large timeouts for setTimeout stop propagation of event loops
Author: medikoo
Created: 2011-10-13 11:54:28+00:00
State: open

Not sure if I coined issue title right, but check following snippet:

```javascript
var stat = require('fs').stat, limit = 40, open = 0;

while (--limit) {
(function () {
console.log('open', ++open);
var t = setTimeout(function () {}, Infinity);

stat(__filename, function () {
console.log('close', --open);
});

setTimeout(function () {
clearTimeout(t);
}, 5000);
}());
}
```

It doesn't work properly on Node versions >= 0.5.7 (including 0.5.9)

Only first few stat callbacks are called, the rest is hanging and is released only after timeouts are cleared, it's probably bug in timeout/event loop resolution logic.