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

Q fails to perform circularity check #832

@marijaselakovic

Description

@marijaselakovic

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions