Skip to content

Preserve AsyncLocalStorage context during dynamic import() module evaluation - #32695

Closed
robobun wants to merge 5 commits into
mainfrom
farm/46f85f9b/als-dynamic-import-eval
Closed

Preserve AsyncLocalStorage context during dynamic import() module evaluation#32695
robobun wants to merge 5 commits into
mainfrom
farm/46f85f9b/als-dynamic-import-eval

Preserve AsyncLocalStorage context during dynamic import() evaluation

d783beb
Select commit
Loading
Failed to load commit list.
Claude / Claude Code Review completed Jun 25, 2026 in 10m 10s

Code review found 1 important issue

Found 5 candidates, confirmed 1. See review comments for details.

Details

Severity Count
🔴 Important 1
🟡 Nit 0
🟣 Pre-existing 0
Severity File:Line Issue
🔴 Important src/jsc/bindings/ZigGlobalObject.cpp:3620-3626 Map entry leaks when dynamic import rejects asynchronously

Annotations

Check failure on line 3626 in src/jsc/bindings/ZigGlobalObject.cpp

See this annotation in the file changed.

@claude claude / Claude Code Review

Map entry leaks when dynamic import rejects asynchronously

The map entry inserted at line 3607 is only removed when `moduleLoaderEvaluate` runs for the key or when the import promise has *already* settled here — if `importModule` returns a Pending promise that later **rejects asynchronously** (syntax error in the imported file, a transitive static dependency that fails to resolve/parse, or an async `Bun.plugin` `onLoad` rejection), neither path fires and the entry is retained for the lifetime of the global, pinning the captured async context and everyth