fix(browser): close the pages of a project that has no tests left - #10991
Open
JCQuintas wants to merge 1 commit into
Open
fix(browser): close the pages of a project that has no tests left#10991JCQuintas wants to merge 1 commit into
JCQuintas wants to merge 1 commit into
Conversation
5 tasks
✅ 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
requested changes
Aug 18, 2026
sheremet-va
left a comment
Member
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
JCQuintas
marked this pull request as draft
August 18, 2026 10:56
JCQuintas
force-pushed
the
fix/close-idle-browser-pages
branch
6 times, most recently
from
August 20, 2026 14:50
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.
JCQuintas
force-pushed
the
fix/close-idle-browser-pages
branch
from
August 20, 2026 15:01
493b16f to
2552767
Compare
JCQuintas
marked this pull request as ready for review
August 20, 2026 15:19
Author
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 |
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.
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.