Skip to content

fix(terminal): reduce WebGL context pool to leave headroom for Chromium limit#3358

Merged
gregpriday merged 1 commit intodevelopfrom
feature/issue-3277-webgl-context-pool-fills
Mar 16, 2026
Merged

fix(terminal): reduce WebGL context pool to leave headroom for Chromium limit#3358
gregpriday merged 1 commit intodevelopfrom
feature/issue-3277-webgl-context-pool-fills

Conversation

@gregpriday
Copy link
Collaborator

Summary

  • Reduces TerminalWebGLManager.MAX_CONTEXTS from 16 to 12, leaving 4 slots free for any non-terminal WebGL consumers sharing the renderer process
  • Chromium enforces a hard limit of 16 active WebGL contexts per renderer process; claiming the full budget means the first external consumer triggers a forced webglcontextlost eviction on a terminal
  • Adds an inline comment documenting the reasoning and noting that browser/dev-preview panels run in <webview> partitions with their own budgets (so the reservation is conservative headroom for future renderer-resident consumers)

Resolves #3277

Changes

  • src/services/terminal/TerminalWebGLManager.ts: MAX_CONTEXTS 16 → 12, with explanatory comment

Testing

All existing WebGL lifecycle unit tests pass. The change is a single constant reduction with no behavioral impact on the eviction/fallback path.

…um limit

- Lower MAX_CONTEXTS from 16 to 12, reserving 4 slots within Chromium's
  16-context-per-renderer-process hard cap
- Add comment explaining the limit, headroom rationale, and that
  browser/dev-preview panels are process-isolated via webview partitions
@gregpriday
Copy link
Collaborator Author

Review status: Ready

@gregpriday
Copy link
Collaborator Author

Cross-PR review note

After reviewing all 8 open PRs together, these interactions were identified:

Recommended merge sequence:

  1. fix(terminal): reduce WebGL context pool to leave headroom for Chromium limit #3358, fix(memory): switch to privateBytes and add EMA trend detection #3360, fix(layout): use HollowCircle icon in WaitingContainer to match agent state standard #3359, fix(theme): improve light theme token coverage and expand E2E contrast checks #3364 (independent, any order)
  2. fix(terminal): reduce default scrollback from 2500 to 1000 lines #3365 (after group 1)
  3. fix(terminal): skip WebGL renderer on software-only GPU #3362, feat(terminal): reduce xterm.js scrollback for background terminals #3361 (after fix(terminal): reduce WebGL context pool to leave headroom for Chromium limit #3358/fix(terminal): reduce default scrollback from 2500 to 1000 lines #3365 respectively, rebase needed)
  4. feat(memory): graduated memory pressure mitigation #3366 (after fix(memory): switch to privateBytes and add EMA trend detection #3360, rebase needed)

@gregpriday gregpriday merged commit ca6337c into develop Mar 16, 2026
4 checks passed
@gregpriday gregpriday deleted the feature/issue-3277-webgl-context-pool-fills branch March 16, 2026 06:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

WebGL context pool fills Chromium's hard limit, risking forced context eviction

1 participant