fix(browser): wait for orchestrator readiness before resolving browser sessions#10397
Conversation
|
Notes:
I can't (or couldn't think of how to) test this bug as it is a fairly specific timing issue. It would require somehow mocking Playwright, etc so that the connected event fired before / after the
Because this is just a bug fix is an issue needed? I was also able to reproduce this (intermittently) on my local machine by using Linux's |
|
Did you try the fixed version? Does it work for you? |
@vitest/browser
@vitest/browser-playwright
@vitest/browser-preview
@vitest/browser-webdriverio
@vitest/coverage-istanbul
@vitest/coverage-v8
@vitest/expect
@vitest/mocker
@vitest/pretty-format
@vitest/runner
@vitest/snapshot
@vitest/spy
@vitest/ui
@vitest/utils
vitest
@vitest/web-worker
commit: |
✅ Deploy Preview for vitest-dev ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify project configuration. |
If by "try the fixed version" you mean the latest beta release of I tried upgrading to
I'm going to create a new PR for the above race condition = hanging |
|
I meant try the fix that you implemented here. It is obviously not merged, so testing a beta version is meaningless for your use case. You can use the link from the pkg.pr.new or manually applying a fix |
Ah gotcha — now I see what you are saying. I didn't know that there were built versions per-PR for testing. Originally I noticed this bug (CI hanging w/ After figuring out where in code the hanging was coming from I made these changes on the v5 branch — built it locally — and tested that fixed-with-these-changes † but sometimes it did fail but I then narrowed it down to another hanging scenario I detailed in my comment above. |
f513c8b to
79b23eb
Compare
Description
I diagnosed an intermittent failure in our CI runs (about one in five) to a timing issue in vitest. The tests would not fail — vitest would hang until the CI job was killed after a while.
Resolves (do you need an issue for a bug fix?)
I figured out (with the help of Codex) hanging behaviour was caused when the WS upgrade happened (so the
connected()event was triggered on the session), but theorchestratorwasn't created and assigned togetBrowserState().orchestratoryet.The fix was to introduce a "ready" event in the
IframeOrchestrator'sconstructorto signal that the websocket connection is ready. In the session only after both the ready + connected events are seen does the promise returned fromcreateSessionresolve.Please don't delete this checklist! Before submitting the PR, please make sure you do the following:
pnpm-lock.yamlunless you introduce a new test example.Tests
pnpm test:ci.Documentation
pnpm run docscommand.Changesets
feat:,fix:,perf:,docs:, orchore:.AI assisted: Codex