Skip to content

async_hooks: remove legacy AsyncLocalStorage implementation - #63641

Open
mcollina wants to merge 2 commits into
nodejs:mainfrom
mcollina:remove-async-hooks-als
Open

async_hooks: remove legacy AsyncLocalStorage implementation#63641
mcollina wants to merge 2 commits into
nodejs:mainfrom
mcollina:remove-async-hooks-als

Conversation

@mcollina

Copy link
Copy Markdown
Member

Remove the async_hooks-based AsyncLocalStorage fallback and the --no-async-context-frame flag, making AsyncContextFrame the sole implementation.

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/config

@nodejs-github-bot nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. lib / src Issues and PRs related to general changes in the lib or src directory. needs-ci PRs that need a full CI run. labels May 29, 2026
@codecov

codecov Bot commented May 29, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.13%. Comparing base (eae0ca3) to head (23b757b).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #63641      +/-   ##
==========================================
- Coverage   90.13%   90.13%   -0.01%     
==========================================
  Files         751      750       -1     
  Lines      252592   252373     -219     
  Branches    47535    47486      -49     
==========================================
- Hits       227684   227465     -219     
+ Misses      16227    16207      -20     
- Partials     8681     8701      +20     
Files with missing lines Coverage Δ
lib/async_hooks.js 100.00% <100.00%> (ø)
lib/internal/async_context_frame.js 100.00% <100.00%> (ø)
lib/internal/async_hooks.js 99.36% <100.00%> (-0.01%) ⬇️
lib/internal/timers.js 99.75% <100.00%> (-0.01%) ⬇️
src/async_context_frame.cc 100.00% <ø> (ø)
src/node_options.cc 79.60% <ø> (-0.04%) ⬇️
src/node_options.h 94.85% <ø> (-0.49%) ⬇️

... and 32 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@addaleax addaleax added semver-major PRs that contain breaking changes and should be released in the next major version. async_hooks Issues and PRs related to the async hooks subsystem. async_local_storage AsyncLocalStorage labels May 29, 2026
als.run('test-context-1', common.mustCall(() => {
finished(readable, common.mustCall(() => {
assert.strictEqual(AsyncContextFrame.enabled || enabledHooksExist(), true);
assert.strictEqual(!!AsyncContextFrame.current() || enabledHooksExist(), true);

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.

I think this line can be removed together with const { enabledHooksExist } = require('internal/async_hooks');.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Done, removed together with the now-unused imports and the --expose-internals flag.

Remove the async_hooks-based AsyncLocalStorage fallback and the
--no-async-context-frame flag, making AsyncContextFrame the sole
implementation.
Remove the AsyncContextFrame.enabled checks and the
async_local_storage_context_symbol that only served the async_hooks
based implementation, and stop spawning test-timers-async-store-leak
with --no-async-context-frame.
@mcollina
mcollina force-pushed the remove-async-hooks-als branch from 7972ebb to 23b757b Compare August 23, 2026 06:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

async_hooks Issues and PRs related to the async hooks subsystem. async_local_storage AsyncLocalStorage c++ Issues and PRs that require attention from people who are familiar with C++. lib / src Issues and PRs related to general changes in the lib or src directory. needs-ci PRs that need a full CI run. semver-major PRs that contain breaking changes and should be released in the next major version.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants