Q fails to perform circularity check
marijaselakovic opened this issue · comments
Hello,
It seems that Q doesn't detect circular promise chains and in some situations, it can go to an infinite loop that never terminates. I encountered the following piece of code:
var Promise = require('q');
var p1 = new Promise(function (resolve, reject) {
resolve(19)
});
var p2 = p1.then(function (v) {
return p2;
});
var p3 = p2.then(function (v) {
return v
})
First callback to then returns the promise (p2) that is actually returned by then itself, which causes a chaining cycle for p2. This test never terminates. Maybe you would like to check this out.