Skip to content

async_hooks: fix context loss after nested calls to AsyncLocalStorage

Fixes the following issues within AsyncLocalStorage API:

  • Nested calls to run* were erasing the outer store, leading to context loss.
    • Note: test-async-local-storage-nested.js was updated to validate this fix, as its previous contents were a partial duplicate of test-async-local-storage-no-mix-contexts.js
  • Calls to exit* were switching enabled field to true without checking current value. This leads to incorrect behavior of further getStore and run* calls.

These issues were discussed in #31950, but as that PR involves significant changes in implementation and will require some time to settle down.

cc @vdeturckheim @Qard @Flarna

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • commit message follows commit guidelines

Merge request reports

Loading