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

[BUG] Unable to open page with disabled setGraphicsMode #247

Open
heaven opened this issue Mar 29, 2024 · 8 comments
Open

[BUG] Unable to open page with disabled setGraphicsMode #247

heaven opened this issue Mar 29, 2024 · 8 comments
Labels
bug Something isn't working upstream

Comments

@heaven
Copy link

heaven commented Mar 29, 2024

Once chromium.setGraphicsMode = false; open page times out.

Environment

  • chromium Version: 123
  • puppeteer / puppeteer-core Version: 22.6.1
  • Node.js Version: 20.x
  • Lambda / GCF Runtime: nodejs20.x

Expected Behavior

Chromium 112 worked well, disabling graphics mode effectively reducing the launch time by 25-30%.

Current Behavior

Opening a new page freezes forever.

const page = await browser.newPage();

Steps to Reproduce

  chromium.setGraphicsMode = false;

  const browser = await puppeteer.launch({
    args:              chromium.args,
    defaultViewport:   { width: 1366, height: 4608 },
    executablePath:    await chromium.executablePath(),
    headless:          chromium.headless,
    ignoreDefaultArgs: false,
    ignoreHTTPSErrors: true,
    pipe:              true,
    dumpio:            false
  });

  const page = await browser.newPage();

Once setGraphicsMode is commented out things get back to life again.

@heaven heaven added the bug Something isn't working label Mar 29, 2024
@heaven
Copy link
Author

heaven commented Mar 29, 2024

Interestingly, if setting chromium.setGraphicsMode = true; in 112.02, it then freezes 😀

So this setup only works with Node 18 and with graphics mode disabled:

{
  "dependencies": {
    "puppeteer-core": "^19.8.5"
  },
  "devDependencies": {
    "@sparticuz/chromium": "^112.0.2"
  }
}

And this one works well on Node 20 with both graphics modes:

{
  "dependencies": {
    "puppeteer-core": "^22.4.1"
  },
  "devDependencies": {
    "@sparticuz/chromium": "^122.0.0"
  }
}

For us, the graphics mode makes the crawler twice slower. Our script normally finishes in 7.5-8.5 seconds, with the graphics mode enabled it takes 15-18 seconds.

@Sparticuz
Copy link
Owner

[0403/173006.716367:ERROR:check.cc(365)] Check failed: false. NOTREACHED log messages are omitted in official builds. Sorry!
[0403/173006.716370:ERROR:gpu_channel_manager.cc(968)] ContextResult::kFatalFailure: Failed to create shared context for virtualization.
[0403/173006.716373:ERROR:shared_image_stub.cc(728)] SharedImageStub: unable to create context
[0403/173006.716376:ERROR:gpu_channel.cc(767)] GpuChannel: Failed to create SharedImageStub
[0403/173006.716401:ERROR:check.cc(365)] Check failed: false. NOTREACHED log messages are omitted in official builds. Sorry!
[0403/173006.716407:ERROR:gpu_channel_manager.cc(957)] Failed to create GLES3 context, fallback to GLES2.
[0403/173006.716410:ERROR:check.cc(365)] Check failed: false. NOTREACHED log messages are omitted in official builds. Sorry!
[0403/173006.716412:ERROR:gpu_channel_manager.cc(968)] ContextResult::kFatalFailure: Failed to create shared context for virtualization.
[0403/173006.716414:ERROR:shared_image_stub.cc(728)] SharedImageStub: unable to create context
[0403/173006.716417:ERROR:gpu_channel.cc(767)] GpuChannel: Failed to create SharedImageStub
[0403/173006.716541:ERROR:check.cc(365)] Check failed: false. NOTREACHED log messages are omitted in official builds. Sorry!
[0403/173006.716565:ERROR:gpu_channel_manager.cc(957)] Failed to create GLES3 context, fallback to GLES2.
[0403/173006.716570:ERROR:check.cc(365)] Check failed: false. NOTREACHED log messages are omitted in official builds. Sorry!
[0403/173006.716574:ERROR:gpu_channel_manager.cc(968)] ContextResult::kFatalFailure: Failed to create shared context for virtualization.
[0403/173006.716575:ERROR:shared_image_stub.cc(728)] SharedImageStub: unable to create context
[0403/173006.716578:ERROR:gpu_channel.cc(767)] GpuChannel: Failed to create SharedImageStub
[0403/173006.716601:ERROR:check.cc(365)] Check failed: false. NOTREACHED log messages are omitted in official builds. Sorry!
[0403/173006.716608:ERROR:gpu_channel_manager.cc(957)] Failed to create GLES3 context, fallback to GLES2.
[0403/173006.716610:ERROR:check.cc(365)] Check failed: false. NOTREACHED log messages are omitted in official builds. Sorry!
[0403/173006.716613:ERROR:gpu_channel_manager.cc(968)] ContextResult::kFatalFailure: Failed to create shared context for virtualization.
[0403/173006.716615:ERROR:shared_image_stub.cc(728)] SharedImageStub: unable to create context
[0403/173006.716618:ERROR:gpu_channel.cc(767)] GpuChannel: Failed to create SharedImageStub
^[[1;2DFunction 'node20' timed out after 30 seconds  

@Sparticuz Sparticuz added help wanted Extra attention is needed upstream labels Apr 3, 2024
@Sparticuz
Copy link
Owner

Until this bug gets fixed, I'm going to disable turning off accelerated graphics

@Sparticuz
Copy link
Owner

Sorry for the delay, there were other issues with 126 that needed to get fixed. This is now live, however, I'm going to keep the bug open.

Sparticuz added a commit that referenced this issue Jul 17, 2024
* master:
  126.0.0
  don't disable the graphics stack #247
  update to chromium 126
  ignore internal docker folder
  update deps
@Smirow
Copy link

Smirow commented Dec 29, 2024

Hi, forcing --disable-webgl and removing --use-gl=angle and --use-angle=swiftshader seems to work fine on 131.0.0.
Could we re-enable this option to reduce startup time?

@Sparticuz
Copy link
Owner

Hi, forcing --disable-webgl and removing --use-gl=angle and --use-angle=swiftshader seems to work fine on 131.0.0. Could we re-enable this option to reduce startup time?

Awesome, I'll re-add this option if that's the case!

@Smirow
Copy link

Smirow commented Jan 3, 2025

Maybe I am missing something, but oddly enough, even with --disable-webgl (while --use-gl=angle and --use-angle=swiftshader are suppressed) the browser crashes if swiftshader is not present. webgl is definitely off.

@HuyNguyen100
Copy link

https://github.com/Sparticuz/chromium/blob/master/source/index.ts#212
this.graphics
? graphicsFlags.push("--use-gl=angle", "--use-angle=swiftshader")
: graphicsFlags.push("--disable-webgl");
work again in chromium Version: 131.0.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working upstream
Projects
None yet
Development

No branches or pull requests

4 participants