Repository navigation
Description
Background
Since the xterm.js 6.0 upgrade (#16820, first released in 2026.04.0), the terminal_renderer preference value "canvas" is mapped onto the xterm.js WebGL addon, because xterm.js 6.0 removed the canvas renderer. "canvas" is still the default in user-prefs-schema.json, so the Terminal tab now uses WebglAddon by default for all users.
RStudio loads the addon but never subscribes to WebglAddon.onContextLoss:
XTermWidget.enableWebGL()—src/gwt/src/org/rstudio/studio/client/workbench/views/terminal/xterm/XTermWidget.java:446XTermNative.loadWebGLAddon()—src/gwt/src/org/rstudio/studio/client/workbench/views/terminal/xterm/XTermNative.java:203- renderer preference wiring —
src/gwt/src/org/rstudio/studio/client/workbench/views/terminal/TerminalSession.java:192-209
xterm.js exposes WebglAddon.onContextLoss for this case; the addon cannot recover on its own, so the consumer is expected to dispose it and fall back to the DOM renderer when the event fires.
Actual behavior
When the WebGL context is lost, the addon stays loaded with a dead context and the Terminal tab stops painting. Input still reaches the shell, but neither the typed characters nor the shell's output is displayed, so the terminal appears hung. Opening a new terminal or reloading the IDE is the only recovery.
Expected behavior
On context loss, dispose the WebGL addon and fall back to the DOM renderer so the terminal keeps rendering.
How context loss happens in practice
- GPU process crash or graphics driver reset.
- Chromium's cap on simultaneously live WebGL contexts (around 16). Each terminal using WebGL holds one, so enough open terminals — alone or alongside other WebGL content in the browser — can cause the browser to drop the oldest context.
- Some virtualized or remote-desktop graphics stacks.
Notes
- Workaround: uncheck Tools > Global Options > Terminal > Display > "Hardware acceleration", which sets
terminal_rendererto"dom". - Verification requires forcing a context loss, e.g. calling
loseContext()from theWEBGL_lose_contextextension on the terminal's canvas via browser devtools. - Found while triaging RStudio Server terminal stops accepting keyboard input after exiting an SSH session #18386. That report may or may not be caused by this; it is filed separately because the gap exists regardless.
Activity
Fall back to DOM renderer on terminal WebGL context loss (#18405)