Repository navigation
Conversation
✅ Deploy Preview for vitest-dev ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify project configuration. |
sheremet-va
left a comment
There was a problem hiding this comment.
I have very strong race condition vibes here, but can't pinpoint it. closePage is never properly awaited which seems dangerous
4f53657 to
493b16f
Compare
Browser pages were only closed by the provider's `close()`, which runs once the whole workspace run is over. Projects run concurrently and each opens up to `maxWorkers` pages, so a run held `projects * maxWorkers` pages at its peak and the projects that finished early kept their page alive until the slowest one was done. Add an optional `closePage` to `BrowserProvider`, implement it for Playwright, and call it from the pool once a session has no test files left. The results of the last test can still be on their way when that happens, so the session waits for them to be handled before its page goes away. In watch mode the pages are kept so that reruns still reuse the session.
493b16f to
2552767
Compare
Yeah, it is hard to understand what is actually an error with the flaky CI failing every other push 😆 The code should now be more sound with the |
Runs two projects concurrently, one of which finishes while the other is still going, and asserts the provider is asked to close the finished project's page before the slow project's file ends.
9137f99 to
d1797cf
Compare
d1797cf to
ae9ca9b
Compare
|
@sheremet-va this is ready to review from my end. It saw you are busy with the v5 release and also checked this change against, and it seems to be stable, as the v5 changes didn't affect this behaviour. If any change is needed let me know |
|
Hello @JCQuintas. Thank you for taking the time to contribute! Unfortunately, the team accepts pull requests only from maintainers and approved contributors, so this pull request was closed automatically. We are sorry about that, it is not a judgement of your work. The number of pull requests grew beyond what the team can review, and this policy gives maintainers the space to triage and prioritize issues at their own pace. Please keep the discussion in #10990. Your changes are not lost: a maintainer can reopen this pull request if the team decides to go forward with it. See our pull request policy for more context. |
|
I'll keep this open for now, but we are considering a different solution - refactor how browser pool works, it's the only pool that works per-project. |
Written by an AI agent (Claude) on behalf of @JCQuintas, who has reviewed it.
Closes #10990.
In browser mode a project's pages stay open until the whole run ends, because only the provider's
close()closes them. Each project opens up tomaxWorkerspages and they all run concurrently, so the peak isprojects * maxWorkers. Projects that finish early hold their pages, and everything their tests loaded into them, until the slowest one is done.This adds an optional
closePage(sessionId)toBrowserProvider, implemented for Playwright, and closes a session's pages once its project has no test files left.BrowserSessionstracks the results still being handled, so a page is not closed while they arrive. Watch mode keeps the pages, so reruns reuse the session.The close is not awaited inside the run, since a browser that stopped answering would hold up the other projects. The pool's
close()awaits it instead, bounded by the existingPROVIDER_CLOSE_TIMEOUT.In the reproduction from #10990 the open-page count drops from 6 to 0 as the projects finish, instead of staying at 6. For scale, mui-x has 21 browser projects with
maxWorkers: 2: 42 tabs, peaking around 12.8GB against a 16GB CI container, where a renderer gets OOM-killed and the run fails withBrowser page crashedwhile every test passes.