Conversation
`prepareIframe` awaited a promise that only `load`/`error` could settle and neither was bounded, so an iframe whose page or subresource never finishes loading left the pool waiting for that session for the rest of the run (vitest-dev#11243). `waitForReady` and the `ack:` in `sendEventToIframe` already use `getIframeTimeout()` for exactly this reason. The spec covers the third step of the handshake the same way the other two are covered, with a tester page that waits for a subresource that is never answered.
✅ Deploy Preview for vitest-dev ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify project configuration. |
im10furry
marked this pull request as ready for review
September 18, 2026 04:05
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
In browser mode, an iframe that never fires
loadhangs the run for ever:prepareIframeawaits a promise that onlyiframe.onload/iframe.onerrorcan settle, and neither is bounded by a timer, so the pool waits for that session until the job is killed. This is the root cause of #11243 (a WebKit run under CPU pressure, one file out of 128 never reports) and of the "prepare promise never resolves" reports in #10520/#10860.The other two steps of the same handshake are already bounded -
waitForReadyand theack:insendEventToIframeboth usegetIframeTimeout()- so this adds the missing one.Reproduction
Deterministic, without CPU starvation: make the tester page wait for a subresource that never finishes.
test/browser/fixtures/…-style spec intest/browser/specs/readiness.test.ts:with a Vite middleware that never ends the response, and
VITEST_BROWSER_IFRAME_TIMEOUT: '2000'.Before the fix the run hangs and the spec only ends because Vitest's own test timeout fires:
After the fix the file fails in ~2s and the run finishes:
Fix
prepareIframenow rejects with that message aftergetIframeTimeout(), and clears the timer as soon asloadorerrorfires. The error is rejected the same way thewaitForReadytimeout is - it is not dispatched as aniframeerror, because that event rejects any in-flightsendEventToIframefor unrelated iframes.The new spec (
fails instead of hanging when the iframe never loads) is the third sibling of the existingfails instead of hanging when the tester never becomes ready/…stops responding to messages, so all three handshake steps are now covered.Also deterministic: the spec's own run of the hanging page needs no CPU starvation - the subresource is simply never answered, so the hang reproduces on every machine (this is what made the fix verifiable at all; the report notes the original was intermittent).
Deliberately not changed: the response after
ack:#11243 also suggests bounding the
response:after the acknowledgement (its author patched the build withgetIframeTimeout() * 10). I left it alone because the wait is intentionally unbounded - the comment above it says the work "may take any amount of time" - and any fixed multiple (10 minutes in their patch) would fail legitimate long batches. If you want that hang covered too, a liveness ping from the tester (re-pinning a timer in the orchestrator) would do it without inventing a deadline; happy to implement whichever you prefer.Verification
test/browserspecs (--config=vitest.config.unit.mts) on chromium, firefox and webkit: 42 files passed, 1 skipped, 102 tests passed.PROVIDER=playwright vitestintest/browser(78 files, chromium + firefox + webkit): 396 tests passed, identical to the same run onmain.pnpm typecheckand eslint: pass.