joyent/node — pull request #4557 by cxreg (2013-01-10 18:21:06+00:00)
Title: Domain stack fixes

Make domains a little safer by avoiding potentially unbounded stack bloat

The following code will cause the stack to grow:

var d = require("domain");

setTimeout(function() {
console.log('domain stack length is now ' + d._stack.length);
}, 100);

d.create().run(function() {
d.create().run(function() {
d.create().run(function() {
d.create().on("error", function(e) {
console.log("caught " + e)
}).run(function() {
throw new Error("died")
})
})
})
})