René's URL Explorer Experiment


Title: AsyncLocalStore looses context in MakeCallback · Issue #43038 · nodejs/node · GitHub

Open Graph Title: AsyncLocalStore looses context in MakeCallback · Issue #43038 · nodejs/node

X Title: AsyncLocalStore looses context in MakeCallback · Issue #43038 · nodejs/node

Description: Version 18.1.0, 14.19.1 (and most likely a lot others) Platform Tested on Microsoft Windows NT 10.0.22000.0 x64 but very likely platform independent. Subsystem async_hooks What steps will reproduce the bug? Use node::MakeCallback() with ...

Open Graph Description: Version 18.1.0, 14.19.1 (and most likely a lot others) Platform Tested on Microsoft Windows NT 10.0.22000.0 x64 but very likely platform independent. Subsystem async_hooks What steps will reproduce...

X Description: Version 18.1.0, 14.19.1 (and most likely a lot others) Platform Tested on Microsoft Windows NT 10.0.22000.0 x64 but very likely platform independent. Subsystem async_hooks What steps will reproduce...

Opengraph URL: https://github.com/nodejs/node/issues/43038

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"AsyncLocalStore looses context in MakeCallback","articleBody":"### Version\r\n\r\n18.1.0, 14.19.1 (and most likely a lot others)\r\n\r\n### Platform\r\n\r\nTested on `Microsoft Windows NT 10.0.22000.0 x64` but very likely platform independent.\r\n\r\n### Subsystem\r\n\r\nasync_hooks\r\n\r\n### What steps will reproduce the bug?\r\n\r\nUse `node::MakeCallback()` with a receiver different to the `AsyncResource`.\r\n\r\nSee e.g. [snappy 6.x](https://github.com/kesla/node-snappy/blob/53bdf54e6e84e3d898b2f6cd00baeb9f16e9fb43/src/binding.cc#L13-L43) which uses [`Nan::AsyncWorker`](https://github.com/nodejs/nan/blob/16fa32231e2ccd89d2804b3f765319128b20c4ac/nan.h#L1909-L2026).\r\n\r\nIn this setup the complete callback is not called with the `AsyncResource` as target and this results in setting the wrong object as current resource in [`MakeCallback`](https://github.com/nodejs/node/blob/76499898763102272a47d642f905e47c0cc41df0/src/api/callback.cc#L282).\r\n\r\nCalling callbacks with undefined/null/global as target is not that uncommon.\r\n\r\nThe before/after callbacks are called with the correct asyncId but `AsyncLocalStore` relies on the current resource.\r\n\r\n```js\r\nconst { executionAsyncId, AsyncLocalStorage } = require(\"async_hooks\")\r\nconst snappy = require(\"snappy\")\r\nconst als = new AsyncLocalStorage()\r\n\r\nals.run(15, () => {\r\n  snappy.compress(\"Hello World!\", () => {\r\n    const cbId = executionAsyncId()\r\n    console.log(`compressed: ${cbId}, als: ${als.getStore()}`)\r\n  })\r\n})\r\n```\r\n\r\n### How often does it reproduce? Is there a required condition?\r\n\r\nAlways if `MakeCallback` is used with a receiver different then the `AsyncResource` object.\r\n\r\n### What is the expected behavior?\r\n\r\nno context loss\r\n\r\n### What do you see instead?\r\n\r\ncontext loss \r\n\r\n### Additional information\r\n\r\n_No response_","author":{"url":"https://github.com/Flarna","@type":"Person","name":"Flarna"},"datePublished":"2022-05-10T14:19:27Z","url":"https://github.com/nodejs/node/issues/43038"}

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react-reconciler,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@d5750093facf
route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:d12b0f1d-0df0-1c12-a9ae-fbd756f58b70
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-id935C:E530F:61B7A3:81D9A0:6AED1DE9
html-safe-nonceda4ecb37aad2be9cef3c47ffbd18bdac417ed82c49be94c938d94a561f2a38e1
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5MzVDOkU1MzBGOjYxQjdBMzo4MUQ5QTA6NkFFRDFERTkiLCJ2aXNpdG9yX2lkIjoiODQ3NzUxNTk5Mzc3OTYwOTA2NiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac256ea8eba75900387a1002fd9a6ccbee6304fefb6b3fc05264b0847322b6d143
hovercard-subject-tagissue:1231242152
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/nodejs/node/43038/issue_layout
twitter:imagehttps://opengraph.githubassets.com/1aba303fdc08d0037e07f55d72c8baf35966dfac7a9c222a7db42fa169266eab/nodejs/node/issues/43038
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/1aba303fdc08d0037e07f55d72c8baf35966dfac7a9c222a7db42fa169266eab/nodejs/node/issues/43038
og:image:altVersion 18.1.0, 14.19.1 (and most likely a lot others) Platform Tested on Microsoft Windows NT 10.0.22000.0 x64 but very likely platform independent. Subsystem async_hooks What steps will reproduce...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameFlarna
hostnamegithub.com
expected-hostnamegithub.com
Nonee3e0f7f63e50c6fe879198a93a0a023a648ecc0a5e9bc3b5e033ac57172237e6
turbo-cache-controlno-preview
go-importgithub.com/nodejs/node git https://github.com/nodejs/node.git
octolytics-dimension-user_id9950313
octolytics-dimension-user_loginnodejs
octolytics-dimension-repository_id27193779
octolytics-dimension-repository_nwonodejs/node
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id27193779
octolytics-dimension-repository_network_root_nwonodejs/node
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release707a24b346ac8a82878b9c084efaa38a997660cb
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/nodejs/node/issues/43038#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fnodejs%2Fnode%2Fissues%2F43038
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fnodejs%2Fnode%2Fissues%2F43038
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=nodejs%2Fnode
Reloadhttps://github.com/nodejs/node/issues/43038
Reloadhttps://github.com/nodejs/node/issues/43038
Reloadhttps://github.com/nodejs/node/issues/43038
nodejshttps://github.com/nodejs
nodehttps://github.com/nodejs/node
Codehttps://github.com/nodejs/node
Issues655 (655)https://github.com/nodejs/node/issues
Pull requests666 (666)https://github.com/nodejs/node/pulls
Actionshttps://github.com/nodejs/node/actions
Projectshttps://github.com/nodejs/node/projects
Security and qualityhttps://github.com/nodejs/node/security
Insightshttps://github.com/nodejs/node/pulse
https://github.com/nodejs/node
New issuehttps://github.com/login?return_to=https://github.com/nodejs/node/issues/43038
New issuehttps://github.com/login?return_to=https://github.com/nodejs/node/issues/43038
AsyncLocalStore looses context in MakeCallbackhttps://github.com/nodejs/node/issues/43038#top
async_hooksIssues and PRs related to the async hooks subsystem.https://github.com/nodejs/node/issues?q=state%3Aopen%20label%3A%22async_hooks%22
async_local_storageIssues and PRs related to the AsyncLocalStorage API.https://github.com/nodejs/node/issues?q=state%3Aopen%20label%3A%22async_local_storage%22
staleIssues and PRs marked stale due to inactivity and scheduled for automatic closure.https://github.com/nodejs/node/issues?q=state%3Aopen%20label%3A%22stale%22
https://github.com/Flarna
Flarnahttps://github.com/Flarna
on May 10, 2022https://github.com/nodejs/node/issues/43038#issue-1231242152
snappy 6.xhttps://github.com/kesla/node-snappy/blob/53bdf54e6e84e3d898b2f6cd00baeb9f16e9fb43/src/binding.cc#L13-L43
Nan::AsyncWorkerhttps://github.com/nodejs/nan/blob/16fa32231e2ccd89d2804b3f765319128b20c4ac/nan.h#L1909-L2026
MakeCallbackhttps://github.com/nodejs/node/blob/76499898763102272a47d642f905e47c0cc41df0/src/api/callback.cc#L282
Flarnahttps://github.com/Flarna
async_hooksIssues and PRs related to the async hooks subsystem.https://github.com/nodejs/node/issues?q=state%3Aopen%20label%3A%22async_hooks%22
on May 10, 2022https://github.com/nodejs/node/issues/43038#event-6582464805
https://github.com/Flarna
Flarnahttps://github.com/Flarna
on May 10, 2022https://github.com/nodejs/node/issues/43038#issuecomment-1122462440
https://github.com/RafaelGSS
RafaelGSShttps://github.com/RafaelGSS
on May 10, 2022https://github.com/nodejs/node/issues/43038#issuecomment-1122681035
https://github.com/Flarna
Flarnahttps://github.com/Flarna
on May 10, 2022https://github.com/nodejs/node/issues/43038#issuecomment-1122762529
Flarnahttps://github.com/Flarna
async_local_storageIssues and PRs related to the AsyncLocalStorage API.https://github.com/nodejs/node/issues?q=state%3Aopen%20label%3A%22async_local_storage%22
on Apr 25, 2025https://github.com/nodejs/node/issues/43038#event-17401370799
https://github.com/apps/github-actions
github-actionshttps://github.com/apps/github-actions
on Jun 25, 2026https://github.com/nodejs/node/issues/43038#issuecomment-4795120804
GitHub Actionshttps://help.github.com/en/actions
github-actionshttps://github.com/apps/github-actions
staleIssues and PRs marked stale due to inactivity and scheduled for automatic closure.https://github.com/nodejs/node/issues?q=state%3Aopen%20label%3A%22stale%22
on Jun 25, 2026https://github.com/nodejs/node/issues/43038#event-27173601666
https://github.com/apps/github-actions
github-actionshttps://github.com/apps/github-actions
on Jul 27, 2026https://github.com/nodejs/node/issues/43038#issuecomment-5086472107
GitHub Actionshttps://help.github.com/en/actions
github-actionshttps://github.com/apps/github-actions
not plannedhttps://github.com/nodejs/node/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Anot-planned
on Jul 27, 2026https://github.com/nodejs/node/issues/43038#event-28512810715
nigrosimonehttps://github.com/nigrosimone
on Sep 26, 2026https://github.com/nodejs/node/issues/43038#event-31901147309
src: keep ALS store in AsyncResource::MakeCallbackhttps://github.com/nigrosimone/node/commit/cf6df066427128cc93584dfb10750b4b67360d12
cf6df06https://github.com/nigrosimone/node/commit/cf6df066427128cc93584dfb10750b4b67360d12
src: keep ALS store in AsyncResource::MakeCallbackhttps://github.com/nigrosimone/node/commit/154c15a9c01abaffc164420ad5c4bd69a2595622
154c15ahttps://github.com/nigrosimone/node/commit/154c15a9c01abaffc164420ad5c4bd69a2595622
nodejs-github-bothttps://github.com/nodejs-github-bot
on Oct 14, 2026https://github.com/nodejs/node/issues/43038#event-33187314608
src: keep ALS store in AsyncResource::MakeCallbackhttps://github.com/nodejs/node/commit/a0ce8f152bb1536b2c06dcfcc69db080bcdb6cd5
a0ce8f1https://github.com/nodejs/node/commit/a0ce8f152bb1536b2c06dcfcc69db080bcdb6cd5
Sign up for freehttps://github.com/signup?return_to=https://github.com/nodejs/node/issues/43038
Sign in to commenthttps://github.com/login?return_to=https://github.com/nodejs/node/issues/43038
async_hooksIssues and PRs related to the async hooks subsystem.https://github.com/nodejs/node/issues?q=state%3Aopen%20label%3A%22async_hooks%22
async_local_storageIssues and PRs related to the AsyncLocalStorage API.https://github.com/nodejs/node/issues?q=state%3Aopen%20label%3A%22async_local_storage%22
staleIssues and PRs marked stale due to inactivity and scheduled for automatic closure.https://github.com/nodejs/node/issues?q=state%3Aopen%20label%3A%22stale%22
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.