chromium icon indicating copy to clipboard operation
chromium copied to clipboard

[BUG] Unable to open page with disabled setGraphicsMode

Open heaven opened this issue 1 year ago • 4 comments

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 avatar Mar 29 '24 10:03 heaven

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.

heaven avatar Mar 29 '24 13:03 heaven

[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 avatar Apr 03 '24 17:04 Sparticuz

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

Sparticuz avatar Apr 03 '24 18:04 Sparticuz

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 avatar Jul 16 '24 15:07 Sparticuz