cypress-io / cypress

Fast, easy and reliable testing for anything that runs in a browser.
https://cypress.io
MIT License
46.69k stars 3.16k forks source link

ERROR:gpu_memory_buffer_support_x11 on GitHub Ubuntu #25357

Closed MikeMcC399 closed 1 year ago

MikeMcC399 commented 1 year ago

Current behavior

When Cypress is run using a GitHub Ubuntu runner, an error message related to graphics is shown before Cypress shows "Run Starting".

The error message contains the following texts:

"ERROR:gpu_memory_buffer_support_x11.cc(44)" "dri3 extension not supported."

for example:

[1866:0212/100011.310930:ERROR:gpu_memory_buffer_support_x11.cc(44)] dri3 extension not supported.

The error message is output independently of the browser selected, e.g. Electron, Chrome and Firefox on a GitHub runner where debug logs show cypress:cli Starting Xvfb.

No error messages are shown in Ubuntu 22.04 running under VMware Workstation 17 Pro, nor using Ubuntu 22.04 running in Microsoft WSL2 under Windows 11 Pro. In these cases Xvfb is not started (debug log shows cypress:cli Cypress will not spawn own Xvfb).

Desired behavior

If the graphics error listed above does not affect the running of Cypress then their output should be suppressed. The messages can otherwise be misleading for troubleshooting.

The error message is similar to others which are classified as "garbage warnings" in https://github.com/cypress-io/cypress/blob/develop/cli/lib/exec/spawn.js and which are filtered out by that module.

Test code to reproduce

Cypress Version

First reported on Cypress 12.5.1 Issue continues to be reproducible on 13.1.0

Node version

v16.16.0 => v20.5.0

Operating System

Ubuntu on GitHub: ubuntu-20.04 and ubuntu-22.04

Debug Logs

See https://github.com/MikeMcC399/gpu-error-test/actions/workflows/gpu-test-base.yml

Other

Related issues are:

Workaround

If Cypress tests are failing and the cause is unclear it may be useful to rule out any gpu error by making sure that the gpu error described here does not occur.

To prevent the gpu error, add

env:
  ELECTRON_EXTRA_LAUNCH_ARGS: '--disable-gpu'

to the GitHub workflow and use a browser other than the default Electron browser.

Edit: reworked issue

astone123 commented 1 year ago

I also see this when running Ubuntu in Github. Routing this to the e2e team to let them determine how they want to handle this.

ajones270 commented 1 year ago

I also see this when running Ubuntu 22.04 running via Azure Pipelines

lmiller1990 commented 1 year ago

Just to clarify and priotize, is this blocking your test run, or just a quality of life fix? I have seen this warning but it has not prevented running my tests. If you are finding this a blocker, please share, we can prioritize accordingly.

MikeMcC399 commented 1 year ago

@lmiller1990

Just to clarify and priotize, is this blocking your test run, or just a quality of life fix? I have seen this warning but it has not prevented running my tests. If you are finding this a blocker, please share, we can prioritize accordingly.

I have never seen it blocking a test, I have however seen the error quoted by multiple people as being the reason for their test failing, since it is often the last error message which is thrown before the point where users are expecting Cypress to run.

Addressing this issue would help users with an error condition to be able to focus on what the real error might be. So it's a bit more than just a "quality of life" bug. Also it is easily reproducible and it shows up on everybody's test runs.

So I do believe you ought to be putting some priority on fixing it.

rotexhawk commented 1 year ago

Agree with the comment ^. This error randomly fails our pipeline and it is time consuming the run the steps again.

lmiller1990 commented 1 year ago

I agree this is pretty confusing, I have a feeling pipelines are failing for other reasons, which we are either incorrect suppressing or not surfacing. Since this is the last warning people see, they assume it's related (could be, but might be a red herring).

I see (at least) two issues to solve:

  1. my pipeline fails and I don't know why, but I see this warning and googled and landed here - what can I do
  2. this warning is meaningless/red herring, let's get rid of it

This issue is for suppressing the warning (point 2), let's track that here. If you have a failing pipeline and you can reproduce it in a minimal fashion and believe it's related (point 1), please make a new issue and reference this one, we can help fix it, and hopefully add a better error handling around whatever issue is found.

MikeMcC399 commented 1 year ago

Thank you @lmiller1990 for expanding the description above ^ !

My issue is only about the red herring aspect.

It would be great if anybody else, like @rotexhawk, who says that the issue is causing their pipeline to fail could open a new issue with minimal repro steps.


Do you still need me to keep my example repo https://github.com/MikeMcC399/gpu-error-test available or can I delete it now?

There are plenty of examples of this error showing up in the cypress-io/github-action repo that can be seen when viewing the runs of https://github.com/cypress-io/github-action/blob/master/.github/workflows/example-basic.yml

Search under https://github.com/cypress-io/github-action/actions/workflows/example-basic.yml?query=branch%3Amaster for a selection of logs.

lmiller1990 commented 1 year ago

I think you can delete it, the repro is basically: run Cypress on Ubuntu on CI. Thanks!

MikeMcC399 commented 1 year ago

@lmiller1990

I think you can delete it, the repro is basically: run Cypress on Ubuntu on CI. Thanks!

I have deleted it. As you say, it is easy to reproduce.

I revisited it and I find that with Cypress 12.2.0 and ubuntu-20.04 or ubuntu-22.04 the error:

libva error: vaGetDriverNameByIndex() failed with unknown libva error, driver_name = (null)

is no longer shown and I assume this is due to updates in the GitHub runners.

With Cypress 12.5.1 the error message:

[1902:0209/105331.818311:ERROR:gpu_memory_buffer_support_x11.cc(44)] dri3 extension not supported.

is however still being displayed, so this issue remains valid.

MikeMcC399 commented 1 year ago
MikeMcC399 commented 1 year ago
MikeMcC399 commented 1 year ago
MikeMcC399 commented 1 year ago

Workaround

Add

env:
  ELECTRON_EXTRA_LAUNCH_ARGS: '--disable-gpu'

to the GitHub workflow. The result is that the error message

[1866:0212/100011.310930:ERROR:gpu_memory_buffer_support_x11.cc(44)] dri3 extension not supported.

disappears for any selected browser except Electron. For Electron the error message is output at a later stage.

A partial explanation is that with no environment variable ELECTRON_EXTRA_LAUNCH_ARGS defined, the error message is output at a pre-browser selection stage when the built-in Electron browser is running. Adding the environment variable stops Electron trying to use the gpu at this point.

According to Configure browser environment, which shows how to pass an environment variable when a browser is launched, it says "This option is not supported when targeting Electron", so presumably this is the reason that ELECTRON_EXTRA_LAUNCH_ARGS: '--disable-gpu' is having no effect later when Electron has been specifically selected to run as browser.

I reinstated a repro repo at https://github.com/MikeMcC399/gpu-error-test

The remaining error in the electron browser case with full debug logging enabled is shown at:

https://github.com/MikeMcC399/gpu-error-test/actions/runs/4155772179/jobs/7189104496#step:3:1110

  cypress:server:browsers:electron launching browser window to url: http://localhost:45827/__/#/specs/runner?file=cypress/e2e/spec.cy.js +1ms
  cypress:server:browsers:electron debugger attached +14ms
  cypress:server:browsers:electron clearing cache +0ms
[1838:0212/100028.728185:ERROR:gpu_memory_buffer_support_x11.cc(44)] dri3 extension not supported.
stychu commented 1 year ago

https://github.com/cypress-io/cypress/issues/23641#issuecomment-1432977152

lmiller1990 commented 1 year ago

I will post in #23641

mysticdevx commented 1 year ago

I am getting the same error in GitLab runners with the following env. docker image: cypress/base:14.17.3,
cypress: v12.7.0 browser: both in Chrome 108 and Electron 106

MikeMcC399 commented 1 year ago

@mysticdevx

I am getting the same error in GitLab runners with the following env. ... cypress: v12.7.0 browser: both in Chrome 108 and Electron 106

That corresponds to my original post that reported the issue on Cypress 12.5.1 and confirmed that it is still reproducible on Cypress 12.7.0. You can use the workaround in the original post for Chrome, but it doesn't help with Electron.

bilarallen commented 1 year ago

Hello, I'm also encountering this when running parallel test in Jenkins

Before the execution run starts, this error [1993:0313/103123.349474:ERROR:gpu_memory_buffer_support_x11.cc(44)] dri3 extension not supported. displays on every parallel stage image

And during the run this error [2162:0313/103202.872609:ERROR:gl_utils.cc(319)] [.WebGL-0x1590041ac600]GL Driver Message (OpenGL, Performance, GL_CLOSE_PATH_NV, High): GPU stall due to ReadPixels randomly display image

Here's additional info: Cypress version: 12.7.0 CI: Jenkins Docker image: cypress/base:14.16.0 Browser: Electron 106

MikeMcC399 commented 1 year ago

@bilarallen

And during the run this error [2162:0313/103202.872609:ERROR:gl_utils.cc(319)] [.WebGL-0x1590041ac600]GL Driver Message (OpenGL, Performance, GL_CLOSE_PATH_NV, High): GPU stall due to ReadPixels randomly display

andrii-lundiak commented 1 year ago

I do confirm, that setting

env:
  ELECTRON_EXTRA_LAUNCH_ARGS: '--disable-gpu'

does NOT help to avoid :

[2354:0721/173502.928020:ERROR:gpu_memory_buffer_support_x11.cc(44)] dri3 extension not supported

I updated my build.yml file which is used by Azure DevOps CI setup. No Docker directly per se.

Agent name: 'Hosted Agent'
Agent machine name: 'fv-az***-***'
Current agent version: '3.220.5'
Operating System
Ubuntu
22.04.2
LTS
Runner Image
Image: ubuntu-22.04
Version: 20230716.1.0
Included Software: https://github.com/actions/runner-images/blob/ubuntu22/20230716.1/images/linux/Ubuntu2204-Readme.md
Image Release: https://github.com/actions/runner-images/releases/tag/ubuntu22%2F20230716.1
Runner Image Provisioner
2.0.238.1
Current image version: '20230716.1.0'
Agent running as: 'vsts'

My Cypress code is running on top of NodeJS 18.x and Cypress itself is 12.17.2 which has been assuming that MAY help to get rid some Electron issues. CHANGELOG here: https://docs.cypress.io/guides/references/changelog#12-17-2

UPD. I know that env variable suggest that something with Electron, but I also experience this dri3 extension not supported when Chrome browser is sued on CI/Ubuntu: dri3_warning_via_Chrome_

And here is screenshot for Electron run: dri3_warning_via_Electron

And BTW, when I use DEBUG=cypress:* enviromental variable I have then such log:

image

Meaning that it doesn't hint me much of what the reason could be.

andrii-lundiak commented 1 year ago

@MikeMcC399, @ricardo-dematos, @tgreen7 do you still have this issue? I mean gpu_memory_buffer_support_x11 on or dri3 extension not supported issue.

andrii-lundiak commented 1 year ago

And actually, maybe there is NO need "listening" on CI? DevTools listening on ws://127.0.0.1:60830/devtools/browser/c81bcbfe-c257-4d31-b45b-6e32e9d0eb20 (I assume it's Electron/Chrome devtool watch/livereload/hotreload feature) How can I disable this to be 1) used, 2) thrown?

MikeMcC399 commented 1 year ago

@andrii-lundiak

andrii-lundiak commented 1 year ago

@MikeMcC399 I know, but I assumed that it's just after that log entry, and I suspected that maybe it's related (see my above comment w screenshots). But thanks for that another issue. Will research.

samueljholiver commented 1 year ago

some solution worked? I have same problem with azure devops pipeline with ubuntu 20.04

lmiller1990 commented 1 year ago

What is the actual problem? If it's just some text, I don't think there's anything to do - it's just telling you about your environment.

If you really don't like the warning, you can probably disable it. I googled for about 10 seconds and found: https://github.com/seleniumbase/SeleniumBase/issues/1384

Seems a common issue in many other tools, eg selenium https://github.com/seleniumbase/SeleniumBase/issues/1384 / PW https://github.com/microsoft/playwright/issues/15907

Anything for us to do here? I don't think so, Cypress should not be swallowing warnings - if anything, that would make debugging more confusing.

MikeMcC399 commented 1 year ago

@lmiller1990

If you really don't like the warning, you can probably disable it. I googled for about 10 seconds and found: https://github.com/seleniumbase/SeleniumBase/issues/1384

MikeMcC399 commented 1 year ago

Related issues

Related documentation

Continuous integration > Introduction > Running headless tests without Xvfb

MikeMcC399 commented 1 year ago

Suggestion

Add the error message

[1866:0212/100011.310930:ERROR:gpu_memory_buffer_support_x11.cc(44)] dri3 extension not supported.

to the filtered-out Xvfb "garbage warnings" in

https://github.com/cypress-io/cypress/blob/develop/cli/lib/exec/spawn.js

The error message occurs on GitHub Ubuntu runners when Cypress spawns the Xvfb driver (virtual framebuffer X server for X Version 11). Cypress does not spawn Xvfb on Windows nor on macOS runners.

As far as I was able to research this topic, Xvfb does not include support for DRI (Direct Rendering Infrastructure). The error is always logged when running Cypress on Ubuntu on GitHub, and on some other CI providers, except notably CircleCI. It does not appear to be detrimental to running Cypress tests.

Other similar garbage errors are already filtered out:

https://github.com/cypress-io/cypress/blob/f383ae329f116b713fb30c76f9f3ee3d5890f327/cli/lib/exec/spawn.js#L15-L47

hans2520 commented 1 year ago
  • The error message only seems to be displayed when Cypress pulls in Xvfb (virtual framebuffer X server for X Version 11) in a virtual environment where there is otherwise no X11 server available.

I can confirm this to be true -- this happens wherever Cypress is run in headerless mode on Ubuntu 20 -- tested with an AWS EC2 that otherwise has gnome GUI enabled and running via command line headerless still reproduces the warning.

Also, the workaround (set ELECTRON_EXTRA_LAUNCH_ARGS='--disable-gpu' in environment prior to launching Cypress) doesn't work at all -- it merely moves the error from appearing before the tests start, to immediately after the tests start as the first line of output.

MikeMcC399 commented 1 year ago

This issue is no longer reproducible in Cypress 13.2.0.

According to the Changelog:

Presumably this is the reason for the error message no longer appearing.

hans2520 commented 1 year ago

Confirmed issue is fixed in 13.2.0

AlexanderTunick commented 1 year ago

Confirmed

Confirmed issue is fixed in 13.2.0