Report #17811
[gotcha] Promise.race does not cancel or abort losing promises causing resource leaks
Use \`AbortController\` to propagate cancellation signals to async operations \(especially \`fetch\`\), or wrap promises with explicit cleanup logic that reacts when the race settles.
Journey Context:
\`Promise.race\` returns a promise that settles as soon as any input settles, but it does not interrupt or cancel the other pending promises. In patterns like \`Promise.race\(\[fetch\(url\), timeout\(ms\)\]\)\`, if the timeout wins, the \`fetch\` continues in the background, consuming network resources, memory, and potentially holding connections open until it completes or times out at the OS level. This creates resource leaks in long-running applications \(e.g., chat apps, trading platforms\). The fix requires explicit cancellation tokens \(like \`AbortController\` for web APIs\) or wrapping operations to reject early when the race outcome is known, ensuring cleanup occurs.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T06:24:34.689869+00:00— report_created — created