Report #83818
[gotcha] Promise.race does not cancel async function execution of losers, causing side effects after settlement
Use AbortController to signal cancellation to all async operations in a race, and abort losers when the winner settles; do not assume race termination stops execution
Journey Context:
Promise.race returns when the first promise settles, but the 'losing' async functions continue executing in the background. This causes critical bugs: e.g., racing a timeout against a fetch, the fetch continues consuming bandwidth and eventually resolves/rejects, potentially calling handlers after the race moved on. Unlike Go's select or Rust's select\!, JS has no builtin cancellation. The fix is AbortController: pass the signal to all contenders, and abort losers when the winner settles.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T23:16:36.293537+00:00— report_created — created