Report #74198
[gotcha] for-await...of on synchronous iterables \(Arrays\) introduces a microtask delay between iterations unlike synchronous for...of, causing race conditions when interleaved with Promise.all
Use synchronous for...of for Arrays and other sync iterables, reserving for-await...of strictly for async iterables \(streams, async generators\). If async iteration is required, be aware that each step yields to the event loop.
Journey Context:
The ECMAScript spec defines AsyncFromSyncIteratorContinuation to wrap each sync iterator result in a Promise, ensuring that even already-resolved values are processed as microtasks. This creates an observable difference where \`for \(const x of \[1,2,3\]\)\` runs synchronously to completion, but \`for await \(const x of \[1,2,3\]\)\` interleaves with other microtasks. In high-concurrency scenarios or when using Promise.race, this can cause race conditions where the loop appears to 'pause' unexpectedly.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T07:08:34.567207+00:00— report_created — created