Sparticuz / chromium

Chromium (x86-64) for Serverless Platforms
MIT License
1.02k stars 71 forks source link

[BUG] Screenshotting crashes chromium instance #225

Closed martin-dimi closed 7 months ago

martin-dimi commented 10 months ago

Environment

Expected Behavior

Screenshoting to not crash the browser

Current Behavior

Upon taking a screenshot, the browser crashes and closes

  const screenshot = await page.screenshot({
    type: "jpeg",
    fullPage: true,
    animations: "disabled",
    quality: 75
  });
page.screenshot: Browser closed.
==================== Browser output: ====================
<launching> /tmp/chromium --disable-field-trial-config --disable-background-networking
    --enable-features=NetworkService,NetworkServiceInProcess --disable-background-timer-throttling
    --disable-backgrounding-occluded-windows --disable-back-forward-cache --disable-breakpad
    --disable-client-side-phishing-detection --disable-component-update --no-default-browser-check
    --disable-dev-shm-usage
    --disable-features=ImprovedCookieControls,LazyFrameLoading,GlobalMediaControls,DestroyProfileOnBrowserClose,MediaRouter,DialMediaRouteProvider,AcceptCHFrame,AutoExpandDetailsElement,CertificateTransparencyComponentUpdater,AvoidUnnecessaryBeforeUnloadCheckSync,Translate
    --allow-pre-commit-input --disable-hang-monitor --disable-ipc-flooding-protection --disable-popup-blocking
    --disable-prompt-on-repost --disable-renderer-backgrounding --disable-sync --force-color-profile=srgb
    --metrics-recording-only --no-first-run --enable-automation --password-store=basic --use-mock-keychain
    --no-service-autorun --export-tagged-pdf --headless --hide-scrollbars --mute-audio
    --blink-settings=primaryHoverType=2,availableHoverTypes=2,primaryPointerType=4,availablePointerTypes=4 --no-sandbox
    --allow-running-insecure-content --autoplay-policy=user-gesture-required --disable-background-timer-throttling
    --disable-component-update --disable-domain-reliability
    --disable-features=AudioServiceOutOfProcess,IsolateOrigins,site-per-process --disable-ipc-flooding-protection
    --disable-print-preview --disable-dev-shm-usage --disable-setuid-sandbox --disable-site-isolation-trials
    --disable-speech-api --disable-web-security --disk-cache-size=33554432 --enable-features=SharedArrayBuffer
    --hide-scrollbars --ignore-gpu-blocklist --in-process-gpu --mute-audio --no-default-browser-check --no-first-run
    --no-pings --no-sandbox --no-zygote --use-gl=angle --window-size=1920,1080 --single-process
    --disable-blink-features=AutomationControlled --user-data-dir=/tmp/playwright_chromiumdev_profile-0U04ue
    --remote-debugging-pipe --no-startup-window
    <launched> pid=34
        [pid=34][err] [0130/160105.024040:ERROR:angle_platform_impl.cc(43)] RendererVk.cpp:149
        (VerifyExtensionsPresent): Extension not supported: VK_EXT_headless_surface
        [pid=34][err] ERR: RendererVk.cpp:149 (VerifyExtensionsPresent): Extension not supported:
        VK_EXT_headless_surface
        [pid=34][err] [0130/160105.024084:ERROR:angle_platform_impl.cc(43)] RendererVk.cpp:149
        (VerifyExtensionsPresent): Extension not supported: VK_KHR_surface
        [pid=34][err] ERR: RendererVk.cpp:149 (VerifyExtensionsPresent): Extension not supported: VK_KHR_surface
        [pid=34][err] [0130/160105.024099:ERROR:angle_platform_impl.cc(43)] Display.cpp:1014 (initialize): ANGLE
        Display::initialize error 0: Internal Vulkan error (-7): A requested extension is not supported, in
        ../../third_party/angle/src/libANGLE/renderer/vulkan/RendererVk.cpp, initialize:1587.
        [pid=34][err] ERR: Display.cpp:1014 (initialize): ANGLE Display::initialize error 0: Internal Vulkan error (-7):
        A requested extension is not supported, in ../../third_party/angle/src/libANGLE/renderer/vulkan/RendererVk.cpp,
        initialize:1587.
        [pid=34][err] [0130/160105.024115:ERROR:gl_display.cc(498)] EGL Driver message (Critical) eglInitialize:
        Internal Vulkan error (-7): A requested extension is not supported, in
        ../../third_party/angle/src/libANGLE/renderer/vulkan/RendererVk.cpp, initialize:1587.
        [pid=34][err] [0130/160105.024121:ERROR:gl_display.cc(725)] eglInitialize Vulkan failed with error
        EGL_NOT_INITIALIZED
        [pid=34][err] [0130/160105.024130:ERROR:gl_ozone_egl.cc(26)] GLDisplayEGL::Initialize failed.
        [pid=34][err] [0130/160105.024642:ERROR:angle_platform_impl.cc(43)] RendererVk.cpp:149
        (VerifyExtensionsPresent): Extension not supported: VK_EXT_headless_surface
        [pid=34][err] ERR: RendererVk.cpp:149 (VerifyExtensionsPresent): Extension not supported:
        VK_EXT_headless_surface
        [pid=34][err] [0130/160105.024655:ERROR:angle_platform_impl.cc(43)] RendererVk.cpp:149
        (VerifyExtensionsPresent): Extension not supported: VK_KHR_surface
        [pid=34][err] ERR: RendererVk.cpp:149 (VerifyExtensionsPresent): Extension not supported: VK_KHR_surface
        [pid=34][err] [0130/160105.024666:ERROR:angle_platform_impl.cc(43)] Display.cpp:1014 (initialize): ANGLE
        Display::initialize error 0: Internal Vulkan error (-7): A requested extension is not supported, in
        ../../third_party/angle/src/libANGLE/renderer/vulkan/RendererVk.cpp, initialize:1587.
        [pid=34][err] ERR: Display.cpp:1014 (initialize): ANGLE Display::initialize error 0: Internal Vulkan error (-7):
        A requested extension is not supported, in ../../third_party/angle/src/libANGLE/renderer/vulkan/RendererVk.cpp,
        initialize:1587.
        [pid=34][err] [0130/160105.024675:ERROR:gl_display.cc(498)] EGL Driver message (Critical) eglInitialize:
        Internal Vulkan error (-7): A requested extension is not supported, in
        ../../third_party/angle/src/libANGLE/renderer/vulkan/RendererVk.cpp, initialize:1587.
        [pid=34][err] [0130/160105.024680:ERROR:gl_display.cc(725)] eglInitialize Vulkan failed with error
        EGL_NOT_INITIALIZED
        [pid=34][err] [0130/160105.024685:ERROR:gl_ozone_egl.cc(26)] GLDisplayEGL::Initialize failed.
        [pid=34][err] [0130/160105.025280:ERROR:(-1)] Check failed: false.
        [pid=34][err] [0130/160105.025300:ERROR:gpu_channel_manager.cc(869)] Failed to create GLES3 context, fallback to
        GLES2.
        [pid=34][err] [0130/160105.025305:ERROR:(-1)] Check failed: false.
        [pid=34][err] [0130/160105.025310:ERROR:gpu_channel_manager.cc(880)] ContextResult::kFatalFailure: Failed to
        create shared context for virtualization.
        [pid=34][err] [0130/160105.025315:ERROR:shared_image_stub.cc(473)] SharedImageStub: unable to create context
        [pid=34][err] [0130/160105.025328:ERROR:gpu_channel.cc(589)] GpuChannel: Failed to create SharedImageStub
        [pid=34][err] [0130/160105.038258:ERROR:(-1)] Check failed: false.
        [pid=34][err] [0130/160105.038286:ERROR:gpu_channel_manager.cc(869)] Failed to create GLES3 context, fallback to
        GLES2.
        [pid=34][err] [0130/160105.038292:ERROR:(-1)] Check failed: false.
        [pid=34][err] [0130/160105.038297:ERROR:gpu_channel_manager.cc(880)] ContextResult::kFatalFailure: Failed to
        create shared context for virtualization.
        [pid=34][err] [0130/160105.038302:ERROR:shared_image_stub.cc(473)] SharedImageStub: unable to create context
        [pid=34][err] [0130/160105.038310:ERROR:gpu_channel.cc(589)] GpuChannel: Failed to create SharedImageStub
        [pid=34][err] [0130/160105.042058:ERROR:(-1)] Check failed: false.
        [pid=34][err] [0130/160105.042080:ERROR:gpu_channel_manager.cc(869)] Failed to create GLES3 context, fallback to
        GLES2.
        [pid=34][err] [0130/160105.042085:ERROR:(-1)] Check failed: false.
        [pid=34][err] [0130/160105.042090:ERROR:gpu_channel_manager.cc(880)] ContextResult::kFatalFailure: Failed to
        create shared context for virtualization.
        [pid=34][err] [0130/160105.042095:ERROR:shared_image_stub.cc(473)] SharedImageStub: unable to create context
        [pid=34][err] [0130/160105.042102:ERROR:gpu_channel.cc(589)] GpuChannel: Failed to create SharedImageStub
        [pid=34][err] [0130/160106.043692:ERROR:(-1)] Check failed: false.
        [pid=34][err] [0130/160106.043738:ERROR:gpu_channel_manager.cc(869)] Failed to create GLES3 context, fallback to
        GLES2.
        [pid=34][err] [0130/160106.043744:ERROR:(-1)] Check failed: false.
        [pid=34][err] [0130/160106.043749:ERROR:gpu_channel_manager.cc(880)] ContextResult::kFatalFailure: Failed to
        create shared context for virtualization.
        [pid=34][err] [0130/160106.043754:ERROR:shared_image_stub.cc(473)] SharedImageStub: unable to create context
        [pid=34][err] [0130/160106.043764:ERROR:gpu_channel.cc(589)] GpuChannel: Failed to create SharedImageStub
        [pid=34][err] [0130/160106.044114:ERROR:(-1)] Check failed: false.
        [pid=34][err] [0130/160106.044130:ERROR:gpu_channel_manager.cc(869)] Failed to create GLES3 context, fallback to
        GLES2.
        [pid=34][err] [0130/160106.044134:ERROR:(-1)] Check failed: false.
        [pid=34][err] [0130/160106.044139:ERROR:gpu_channel_manager.cc(880)] ContextResult::kFatalFailure: Failed to
        create shared context for virtualization.
        [pid=34][err] [0130/160106.044143:ERROR:shared_image_stub.cc(473)] SharedImageStub: unable to create context
        [pid=34][err] [0130/160106.044148:ERROR:gpu_channel.cc(589)] GpuChannel: Failed to create SharedImageStub
        =========================== logs ===========================
        taking page screenshot
        disabled all CSS animations
        ============================================================

Steps to Reproduce

Possible Solution

Sparticuz commented 10 months ago

Seems like it's not pulling in the switftshader setting, I only see --use-gl=angle in the startup args. In any case, try disabling the graphics stack if you are not using webgl on the page.