feat(browse): add GSTACK_HEADED_NOGPU opt-in for virtual displays

On headless virtual displays (Xvnc/Xvfb on EC2/Linux), Playwright's
bundled Chromium crashes at GPU process init (SIGTRAP) when headed mode
is requested. This renders headed browse completely unusable on remote
Linux servers.

Add GSTACK_HEADED_NOGPU=1 env opt-in that appends --disable-gpu,
--disable-gpu-compositing, --disable-software-rasterizer, and
--disable-dev-shm-usage to launch args so the GPU process is bypassed
entirely. This keeps headed mode alive on VNC-backed displays without
affecting users on real displays who don't set the flag.
This commit is contained in:
Aurora Capital 2026-06-08 13:01:11 +00:00
parent cab774cced
commit 15f079c6a2
1 changed files with 11 additions and 0 deletions

View File

@ -442,6 +442,17 @@ export class BrowserManager {
// Sites like Google and NYTimes check this to block automation browsers.
'--disable-blink-features=AutomationControlled',
];
// Headless virtual displays (Xvnc/Xvfb on EC2) have no real GPU; Playwright's
// bundled Chromium crashes (SIGTRAP) during GPU process init. Disabling the
// GPU process keeps headed mode alive on VNC. Opt-in via GSTACK_HEADED_NOGPU.
if (process.env.GSTACK_HEADED_NOGPU === '1') {
launchArgs.push(
'--disable-gpu',
'--disable-gpu-compositing',
'--disable-software-rasterizer',
'--disable-dev-shm-usage',
);
}
if (extensionPath) {
// Skip --load-extension when running against a custom Chromium build
// that already bakes the extension in as a component extension