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

async_hooks: proper id stacking for Promises #13585

Merged
merged 1 commit into from
Jun 16, 2017

Commits on Jun 16, 2017

  1. async_hooks: proper id stacking for Promises

    Until now, the async_hooks PromiseHook did not register the Promise’s
    async id and trigger id on the id stack, so inside the `.then()` handler
    those ids would be invalid.
    
    To fix this, add push and pop calls to its `before` and `after` parts,
    respectively. Some care needs to be taken for the cases that the
    Promise hook is being disabled or enabled during the execution
    of a Promise handler; in the former case, actually removing the hook
    is delayed by adding another task to the microtask queue, in the latter
    case popping the id off the async id stack is skipped if the ids don’t
    match.
    
    Fixes: nodejs#13583
    PR-URL: nodejs#13585
    Reviewed-By: Trevor Norris <[email protected]>
    addaleax committed Jun 16, 2017
    Configuration menu
    Copy the full SHA
    af1a551 View commit details
    Browse the repository at this point in the history