Skip to content

Exit unsettled top-level await instead of hanging / busy-looping#29549

Closed
robobun wants to merge 33 commits into
mainfrom
farm/ed4a7fa6/fix-abortsignal-timeout-tla-hang
Closed

Exit unsettled top-level await instead of hanging / busy-looping#29549
robobun wants to merge 33 commits into
mainfrom
farm/ed4a7fa6/fix-abortsignal-timeout-tla-hang

onBeforeExit: drain microtasks after dispatch so TLA continuations co…

207afb3
Select commit
Loading
Failed to load commit list.
Claude / Claude Code Review completed May 5, 2026 in 35m 58s

Code review found 2 potential issues

Found 4 candidates, confirmed 2. See review comments for details.

Details

Severity Count
🔴 Important 0
🟡 Nit 2
🟣 Pre-existing 0
Severity File:Line Issue
🟡 Nit src/jsc/VirtualMachine.zig:959 Non-watcher path: TLA continuation that throws inside onBeforeExit drain is silently swallowed (exit 0)
🟡 Nit src/jsc/event_loop.zig:591 Hardcoded cross-file line number 'hot_reloader.zig:278' in doc-comment will drift

Annotations

Check warning on line 959 in src/jsc/VirtualMachine.zig

See this annotation in the file changed.

@claude claude / Claude Code Review

Non-watcher path: TLA continuation that throws inside onBeforeExit drain is silently swallowed (exit 0)

nit: sibling to the resolved comment at event_loop.zig:700 (the *resolve* case, fixed by 207afb3) — if a `process.on('beforeExit', …)` handler resolves an abandoned TLA whose continuation then *throws* (e.g. `const r = await later; throw new Error('boom')`), this drain settles the module `JSInternalPromise` to `.rejected` and nothing reports it: the non-watcher path's only reporter (bun.js.zig:402-425) already ran while the promise was `.pending`, `JSInternalPromise` rejections don't flow throug

Check warning on line 591 in src/jsc/event_loop.zig

See this annotation in the file changed.

@claude claude / Claude Code Review

Hardcoded cross-file line number 'hot_reloader.zig:278' in doc-comment will drift

nit: the doc-comment on `hasAnyHandleWork()` references "the hot-reloader watcher at `hot_reloader.zig:278`" — a hardcoded cross-file line number that will drift on any edit above that line. This is the same drift hazard you already accepted and fixed in this PR for the "line 720" reference in VirtualMachine.zig (commit 93e2313). For consistency, replace with a stable symbolic reference like "in `HotReloader.Task.enqueue()`".