Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add --disable-gpu in the default Chromium args #262

Merged
merged 1 commit into from
Aug 25, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions default.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@
},
"rendering": {
"chromeBin": null,
"args": [
"--no-sandbox"
],
"args": ["--no-sandbox", "--disable-gpu"],
"ignoresHttpsErrors": false,

"timezone": null,
Expand All @@ -42,4 +40,4 @@
"verboseLogging": false,
"dumpio": false
}
}
}
7 changes: 2 additions & 5 deletions dev.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,7 @@
},
"rendering": {
"chromeBin": null,
"args": [
"--no-sandbox",
"--disable-setuid-sandbox"
],
"args": ["--no-sandbox", "--disable-setuid-sandbox", "--disable-gpu"],
"ignoresHttpsErrors": false,

"timezone": null,
Expand All @@ -43,4 +40,4 @@
"verboseLogging": false,
"dumpio": true
}
}
}
3 changes: 2 additions & 1 deletion devenv/docker/ha/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"rendering": {
"timezone": null,
"chromeBin": null,
"args": ["--no-sandbox", "--disable-gpu"],
"ignoresHttpsErrors": false,
"timingMetrics": true,
"mode": "default",
Expand All @@ -18,4 +19,4 @@
"maxConcurrency": 5
}
}
}
}
2 changes: 1 addition & 1 deletion docs/remote_rendering_using_docker.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ RENDERING_DUMPIO=true

**Start browser with additional arguments:**

Additional arguments to pass to the headless browser instance. Default is `--no-sandbox`. The list of Chromium flags can be found [here](https://peter.sh/experiments/chromium-command-line-switches/). Multiple arguments is separated with comma-character.
Additional arguments to pass to the headless browser instance. Defaults are `--no-sandbox,--disable-gpu`. The list of Chromium flags can be found [here](https://peter.sh/experiments/chromium-command-line-switches/) and the list of flags used as defaults by Puppeteer can be found [there](https://github.com/puppeteer/puppeteer/blob/main/src/node/Launcher.ts#L172). Multiple arguments is separated with comma-character.

```bash
RENDERING_ARGS=--no-sandbox,--disable-setuid-sandbox,--disable-dev-shm-usage,--disable-accelerated-2d-canvas,--disable-gpu,--window-size=1280x758
Expand Down
6 changes: 6 additions & 0 deletions src/browser/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ export function createBrowser(config: RenderingConfig, log: Logger): Browser {
return new ReusableBrowser(config, log);
}

if (!config.args.includes['--disable-gpu']) {
log.warn(
'using default mode without the --disable-gpu flag is not recommended as it can cause Puppeteer newPage function to freeze, leaving browsers open'
);
}

return new Browser(config, log);
}

Expand Down
2 changes: 1 addition & 1 deletion src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export interface PluginConfig {

const defaultRenderingConfig: RenderingConfig = {
chromeBin: undefined,
args: ['--no-sandbox'],
args: ['--no-sandbox', '--disable-gpu'],
ignoresHttpsErrors: false,
timezone: undefined,
acceptLanguage: undefined,
Expand Down