fix(desktop): raise Chromium WebGL context cap to 256#3834
Conversation
Chromium defaults `max-active-webgl-contexts` to 16 per renderer process. Each xterm holds one WebGL context, and the v2 parking model keeps panes alive across workspace switches, so cumulative panes routinely reach the low hundreds. Once over the cap, Blink forcibly fires `webglcontextlost` on the oldest pane, producing the blank/garbled terminals in #3572, #3504, #3527. Raising to 256 covers low-hundreds of cumulative panes while staying bounded enough to surface a real leak. Does not address upstream xterm.js texture-atlas bugs (xtermjs/xterm.js#5849), which manifest as similar corruption but require a different fix.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughA Chromium command-line switch Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Drop issue references (belong in PR description) and Chromium source path (rots if files move). Keep the WHY: parking holds contexts, default 16 is too low at hundreds of cumulative panes, 256 is bounded enough to surface leaks.
Greptile SummaryThis PR raises Chromium's The fix is well-scoped and thoroughly documented. One minor observation: the switch is applied unconditionally on all platforms, including Linux where Confidence Score: 5/5Safe to merge — targeted one-liner fix with excellent rationale, no logic or security concerns. The change is a single well-justified Chromium command-line switch addition. All findings are P2 or lower (Linux no-op is harmless). No data-integrity, security, or correctness issues are present. No files require special attention.
|
| Filename | Overview |
|---|---|
| apps/desktop/src/lib/electron-app/factories/app/setup.ts | Adds max-active-webgl-contexts Chromium switch set to 256, raising the cap from the default 16 to prevent forced webglcontextlost events on xterm panes; change is unconditional across all platforms including Linux where hardware acceleration is already disabled. |
Sequence Diagram
sequenceDiagram
participant App as Electron App (startup)
participant Chromium as Chromium Renderer Process
participant xterm as xterm.js pane (WebGL)
App->>Chromium: appendSwitch("max-active-webgl-contexts", "256")
note over Chromium: cap raised from 16 → 256
loop Each new pane opened / workspace switch
xterm->>Chromium: request WebGL context
Chromium-->>xterm: context granted (v2 parking keeps alive)
end
note over Chromium,xterm: Before fix: >16 contexts → ForciblyLoseOldestContext → webglcontextlost → blank terminal
note over Chromium,xterm: After fix: up to 256 contexts before eviction kicks in
Reviews (1): Last reviewed commit: "deslop: trim WebGL cap-raise comment" | Re-trigger Greptile
🧹 Preview Cleanup CompleteThe following preview resources have been cleaned up:
Thank you for your contribution! 🎉 |
Chromium defaults
max-active-webgl-contextsto 16 per renderer process. Each xterm holds one WebGL context, and the v2 parking model keeps panes alive across workspace switches, so cumulative panes routinely reach the low hundreds. Once over the cap, Blink forcibly fireswebglcontextloston the oldest pane, producing the blank/garbled terminals in #3572, #3504, #3527.Raising to 256 covers low-hundreds of cumulative panes while staying bounded enough to surface a real leak. Does not address upstream xterm.js texture-atlas bugs (xtermjs/xterm.js#5849), which manifest as similar corruption but require a different fix.
Description
Related Issues
Type of Change
Testing
Screenshots (if applicable)
Additional Notes
Summary by cubic
Raise Chromium’s active WebGL context limit from 16 to 256 to stop terminals from blanking when many panes persist across workspace switches. Adds the
max-active-webgl-contextscommand-line switch so older contexts aren’t evicted under load.Written for commit bc55d17. Summary will update on new commits. Review in cubic
Summary by CodeRabbit