Skip to content

Let the CI GPU flag reach the Cypress browser - #112

Open
coutoPL wants to merge 25 commits into
masterfrom
fix/e2e-electron-gpu-flag
Open

Let the CI GPU flag reach the Cypress browser#112
coutoPL wants to merge 25 commits into
masterfrom
fix/e2e-electron-gpu-flag

Conversation

@coutoPL

@coutoPL coutoPL commented Aug 20, 2026

Copy link
Copy Markdown
Collaborator

What breaks today

Reporting.cy.ts fails on Kibana 9.5.1. It does not fail an assertion. The browser dies.

Cypress calls this a renderer crash. The crash stops the whole spec file. The three other tests do not run, so the report shows 1 failing, 3 skipped.

I read the logs of eight crashes in five jobs from the last week. All eight are the same:

  • All eight are in Reporting.cy.ts. No other spec crashed.
  • All eight are on the Discover page.
  • All eight are on 9.5.1. Versions 9.4.5, 8.19.20 and 7.17.29 never crash.
  • The test logs in. The browser opens Discover. The browser stops for about 3 minutes. Then it dies.

The servers were healthy at that moment. Elasticsearch used 2.5 GB and 2% of the CPU. Kibana used 950 MB. The machine had 8 GB of free memory. No container was out of memory. Only the browser was dead.

Reporting.cy.ts fails first because it opens Discover more often than the other specs. It logs in four times, and each test goes to Discover again.

Why it happens

We start the browser with the wrong flag.

The workflow sets this variable for the test step:

ELECTRON_EXTRA_LAUNCH_ARGS: '--disable-gpu'

But package.json set the same variable again, on the command line. The command line wins. So Electron got --ignore-gpu-blocklist, and never got --disable-gpu.

The effect is the opposite of the intent. The CI machine has no graphics card. Electron tried to use one, and fell back to the SwiftShader software driver. That driver is slow, and it is not stable. The job logs show it:

ContextResult::kFatalFailure: fail_if_major_perf_caveat + swiftshader
Automatic fallback to software WebGL has been deprecated
GPU stall due to ReadPixels

Discover in Kibana 9.5.1 is a heavy page. The software driver must draw it. The browser stops, and then it dies.

Commit 4888f08 added --ignore-gpu-blocklist in June. It fixed a WebGL problem on macOS for local runs. It also overrode CI from that day, and nobody saw it.

What this PR changes

  • package.json now keeps ELECTRON_EXTRA_LAUNCH_ARGS if the caller sets it. It uses --ignore-gpu-blocklist only as the default. CI therefore gets --disable-gpu, and a local macOS run keeps the June fix.
  • run-tests.sh no longer exports --disable-gpu. That line had no effect in CI, and it cancelled the June fix on your laptop.

I tested the default in sh and in bash. If the variable is unset or empty, the browser gets --ignore-gpu-blocklist. If the caller sets it, the browser gets that value.

One honest limit

The flag is not proof. The crashes started on 13 August, when 9.5.1 entered the matrix. The flag is two months older. Kibana 9.5.1 is the trigger, but this flag is the part we own, and it is wrong today.

Please do not read one green run as a pass. The crash appears in about one attempt in three. The workflow also retries the whole suite once, so a nightly job can show green on the second attempt.

If the crash comes back, the next step is to run CI on Chrome instead of Electron. That removes this class of failure. It also lets us switch on the CSV download check that is off today in Discover.exportToCsv.

The workflow sets ELECTRON_EXTRA_LAUNCH_ARGS to --disable-gpu. The yarn
"run" script set the same variable again on the command line. The command
line won, so Electron got --ignore-gpu-blocklist and never got
--disable-gpu.

The CI machine has no GPU. Electron fell back to the SwiftShader software
driver. On Kibana 9.5.1 the Discover page then stopped the browser, and
the renderer crashed. That crash killed Reporting.cy.ts and skipped its
remaining tests.

The "run" script now keeps the variable if the caller sets it, and uses
--ignore-gpu-blocklist only as the default. run-tests.sh no longer forces
--disable-gpu, because that also cancelled the macOS fix for local runs.
@coderabbitai

This comment was marked as outdated.

coutoPL added 24 commits August 20, 2026 23:32
The repo variable ROR_S3_PATH_E2E_REPORTS ends with a slash, and the upload
action appends /build_<run id> to it. Every key therefore carried // in the
middle, and the DGP gateway answers 400 to such a PUT. Uploads went from
uploaded=65 on 17 Aug to uploaded=0 failed=32 on 20 Aug, so a red e2e job now
leaves no video and no screenshot behind.

Squeeze the repeated slashes in the prefix. The key is then correct whatever
the variable holds, and all three call sites get the fix.
The renderer crash in Reporting.cy.ts survived the GPU flag change: run
32350527210 crashed seven times in 60 suite runs, against three in 15 for the
same-day nightly on master. The flag is not the cause, so Electron itself is
the next suspect.

CYPRESS_BROWSER now selects the browser. Electron stays the default, so a local
run does not change, and the three CI e2e steps ask for Chrome. run-tests.sh
prints the browser it uses, and a one-second step prints the Chrome version, so
each log says plainly which browser ran and fails early if the image lacks it.

If Chrome runs clean, the CSV download check that Discover.exportToCsv skips
today can come back as well.
Chrome refuses navigator.clipboard.readText() until the browser grants the
permission. Every test that reads a copied link therefore failed with
NotAllowedError as soon as the suite left Electron: run 32423280991 shows seven
or eight such failures in each job, in Tenancy.cy.ts and in the two read-only
sanity checks.

Grant the permission through CDP before the read, and only for a real Chromium
browser, since Electron asks for nothing. Focus the document as well, because
headless Chrome reads the clipboard only for a focused page.
The permission grant removed the NotAllowedError, but headless Chrome still
gives a test an empty clipboard. Run 32456671873 shows the result in every job:
expected '' to include 'https://localhost:5601/s/default/app/r/s', in
Tenancy.cy.ts and in the two read-only sanity checks.

Remember what the page copies instead. Kibana copies through
navigator.clipboard.writeText or through document.execCommand('copy') over a
selected node, so both paths now record the text, and the test reads it back.
The real clipboard stays as the fallback, which is the path Electron keeps
taking.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant