Repository navigation
test: release each browser test file's WebGL contexts when it ends - #11196
chrisgervang wants to merge 2 commits into
Conversation
The headless and browser projects run every file in one page. Deck and map instances keep their WebGL contexts after they are finalized, so contexts that files leave behind add up. When the page goes over Chromium's limit, Chromium drops the oldest context, the shared test device, and every later GPU test fails with "WebGL context is lost". Whether that happens depends on file order, so it shows up as flaky coverage and webgpu runs. A new setup file records the WebGL contexts each file creates and loses them in afterAll, keeping the shared synchronous test device. luma.gl's async test devices recreate themselves when their context is lost. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LGNhMnSJ94uYgx7ihcVwPn
[Low impact] The PR appears safe to merge based on this follow-up review. SummaryAdds cleanup that releases WebGL contexts after each browser test file while keeping the shared test device.
No new issues found in the follow-up changes. Reviews (2) · Last reviewed commit: "docs(test): document the context-release..." · Reviewed by Greptile |
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LGNhMnSJ94uYgx7ihcVwPn
Same as #11196. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LGNhMnSJ94uYgx7ihcVwPn
|
Closing in favor of fixing the leak at its source. This setup file works, but it patches The root cause is in deck.gl: Generated by Claude Code |
For #11036
Background
The
headlessandbrowserprojects run every file in one page. Deck and map instances keep their WebGL contexts after they are finalized, so contexts add up. Past Chromium's limit, it drops the oldest one, the shared test device, and every later GPU test fails with "WebGL context is lost". It depends on file order, so it shows up as flakytest-coverageandtest-webgpuruns (for example on #11181 at 510b2f9, aftermaplibre/globe-icons-text.spec.ts).Change List
test/setup/release-webgl-contexts.ts: loses each file's WebGL contexts inafterAll, keeping the shared test deviceheadlessandbrowserprojects load itSplit out of #11183, which needs it for its added browser specs. Verified with the full
headlessproject: 286 files pass, no lost contexts.Generated by Claude Code
Note
Low Risk
Test infrastructure change affecting only browser test suites with no runtime or production impact.
Overview
Adds a test setup helper (
release-webgl-contexts.ts) that wrapsHTMLCanvasElement.prototype.getContextto record WebGL contexts instantiated during a test file's run. At the end of each test file inafterAll, recorded contexts are explicitly destroyed usingWEBGL_lose_contextwhile preserving the shared test device.Registers the new setup file in
vitest.config.tsfor both theheadlessandbrowsertest projects. This prevents non-isolated Chromium sessions from exhausting WebGL context limits and causing downstream test flakiness.Reviewed by Cursor Bugbot for commit cf9a622. Bugbot is set up for automated code reviews on this repo. Configure here.