Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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 join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants