Skip to content

async_hooks: fix AsyncLocalStorage in unhandledRejection cases - #41202

Closed
bmeck wants to merge 8 commits into
nodejs:masterfrom
bmeck:uncaught-rejection-async-local-storage
Closed

async_hooks: fix AsyncLocalStorage in unhandledRejection cases#41202
bmeck wants to merge 8 commits into
nodejs:masterfrom
bmeck:uncaught-rejection-async-local-storage

Conversation

@bmeck

Copy link
Copy Markdown
Member

Right now async local storage doesn't properly propagate through unhandledRejections. This fixes that.

@bmeckbmeck added confirmed-bug Issues with confirmed bugs. promises Issues and PRs related to ECMAScript promises. async_hooks Issues and PRs related to the async hooks subsystem. labels Dec 16, 2021
@nodejs-github-botnodejs-github-bot added needs-ci PRs that need a full CI run. process Issues and PRs related to the process subsystem. labels Dec 16, 2021
@bmeckbmeck added the wip Issues and PRs that are still a work in progress. label Dec 17, 2021
@bmeck

Copy link
Copy Markdown
MemberAuthor

there is some kind of bug with the async id stack with this PR, DO NOT MERGE yet

@bmeck

Copy link
Copy Markdown
MemberAuthor

@Qard and I did some poking and it seems some other stuff is likely messed up around here #41222 , I cannot write a test that covers all the branches of unhandledRejection + uncaughtExceptionMonitor because of it.

@vdeturckheimvdeturckheim left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with the call stack issues to be fixed. This would actually help me for implementing an idea I have for #40954

@vdeturckheim

Copy link
Copy Markdown
Member

@bmeck does that mean only the tests are broken and not the actual feature?

@bmeck

Copy link
Copy Markdown
MemberAuthor

@vdeturckheim the feature isn't fully fixed it looks like, if you register uncaughtExceptionMonitor things look like they aren't correct. unhandledRejection seems to work fine with this PR. Registering both events gets all sort of broken (regardless of this PR).

@bmeck

Copy link
Copy Markdown
MemberAuthor

@Qard please re-review

@QardQard left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks to be some lint errors, but after those are resolved should be good to go.

Comment threadtest/parallel/test-async-wrap-pop-id-during-load.js Outdated
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@bmeckbmeck added author ready PRs that have at least one approval, no pending requests for changes, and a CI started. and removed wip Issues and PRs that are still a work in progress. labels Dec 21, 2021
@bmeck

Copy link
Copy Markdown
MemberAuthor

Landed in c3866b0

@bmeckbmeck closed this Dec 21, 2021
bmeck added a commit that referenced this pull request Dec 21, 2021
PR-URL: #41202
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Vladimir de Turckheim <vlad2t@hotmail.com>
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
Reviewed-By: Minwoo Jung <nodecorelab@gmail.com>
targos pushed a commit that referenced this pull request Jan 14, 2022
PR-URL: #41202
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Vladimir de Turckheim <vlad2t@hotmail.com>
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
Reviewed-By: Minwoo Jung <nodecorelab@gmail.com>
@targostargos mentioned this pull request Jan 16, 2022
danielleadams pushed a commit that referenced this pull request Jan 31, 2022
PR-URL: #41202
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Vladimir de Turckheim <vlad2t@hotmail.com>
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
Reviewed-By: Minwoo Jung <nodecorelab@gmail.com>
danielleadams pushed a commit that referenced this pull request Feb 1, 2022
PR-URL: #41202
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Vladimir de Turckheim <vlad2t@hotmail.com>
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
Reviewed-By: Minwoo Jung <nodecorelab@gmail.com>
@danielleadamsdanielleadams mentioned this pull request Feb 1, 2022
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

async_hooksIssues and PRs related to the async hooks subsystem.author readyPRs that have at least one approval, no pending requests for changes, and a CI started.confirmed-bugIssues with confirmed bugs.needs-ciPRs that need a full CI run.processIssues and PRs related to the process subsystem.promisesIssues and PRs related to ECMAScript promises.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants

@bmeck@vdeturckheim@nodejs-github-bot@Qard@jasnell@JungMinu