Skip to content
This repository has been archived by the owner on Jan 22, 2025. It is now read-only.

Q fails to perform circularity check #832

Open
marijaselakovic opened this issue Apr 23, 2018 · 1 comment
Open

Q fails to perform circularity check #832

marijaselakovic opened this issue Apr 23, 2018 · 1 comment

Comments

@marijaselakovic
Copy link

marijaselakovic commented Apr 23, 2018

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.

@gustavlsouz
Copy link

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants