6

We are using drone for our CI and run Cypress inside drone to test our application (Angular 7).

All the test are running fine on my local machine, but in the CI the tests fail because Chrome Renderer crashed. Around 50% fail, even though they are really not long or complex (most of them just about 5-10 lines).

I know that this is a known issue (https://github.com/cypress-io/cypress/issues/350) and spent quite some time trying the various fixes that have been proposed online. I already tried:

  • increasing the size of dev/shm
  • upgrading to latest versions of drone, drone-agent and cypress
  • decreasing numTestsKeptInMemory setting

The fix mostly promoted, setting --ipc=host does currently not work with drone (https://discourse.drone.io/t/does-drone-support-ipc-host-option/1049).

I am actually a bit confused because the original ticket explicitly states When running headlessly on very long and memory intense applications we are seeing renderer crashes with Docker. I am quite sure that our application does neither qualify as very long nor memory intense (the page consumes around 50-80mb says Chrome Task Manager), so maybe our issue is actually something else?

Can anyone maybe give some more hints if I missed something here?

tommueller
  • 2,358
  • 2
  • 32
  • 44

2 Answers2

6

We were able to fix this by disabling Chrome's usage of /dev/shm completely, by adding this to our plugins/index.js-file.

From Cypress version 4 syntax:

on('before:browser:launch', (browser, launchOptions) => {
  if (browser.name === 'chrome') {
    launchOptions.args.push('--disable-dev-shm-usage')
  }

  return launchOptions
})

Until Cypress version 3 syntax:

on('before:browser:launch', (browser = {}, args) => {
  if (browser.name === 'chrome') {
    args.push('--disable-dev-shm-usage')
  }
  return args
})

Source: https://github.com/cypress-io/cypress/issues/350#issuecomment-574072211

tommueller
  • 2,358
  • 2
  • 32
  • 44
  • FYI this way of passing args is now deprecated. The second argument `args` is not an array anymore but an object `launchOptions` which has `args` as an array property. More on this here https://docs.cypress.io/guides/references/migration-guide#Plugin-Event-before-browser-launch. – Vergil C. Jul 13 '21 at 10:35
  • This flag is now passed to Chrome browser flags by default starting from cypress v6 [docs](https://docs.cypress.io/guides/references/migration-guide#disable-dev-shm-usage) [changelog](https://docs.cypress.io/guides/references/changelog#6-0-0) – Parsa Apr 05 '23 at 06:38
-1

If your CI environment is running the Cypress Test Runner and a browser within a docker image, you can specify the --ipc=host argument to use the host system’s IPC namespace.

Check specific details for your CI environment to find out how to include this argument when running your image.

This is a known issue tracked on the Cypress Github Issues as ticket #350: https://github.com/cypress-io/cypress/issues/350


Unfortunately setting the --ipc=host argument from Drone is not currently supported.

Trent
  • 4,208
  • 5
  • 24
  • 46
  • Thanks, but as i said in my question: `The fix mostly promoted, setting --ipc=host does currently not work with drone ` – tommueller Feb 28 '20 at 06:25