Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cypress tests failing because Chrome Renderer is crashing in CI (using drone)

Tags:

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?

like image 366
tommueller Avatar asked Jan 07 '20 13:01

tommueller


1 Answers

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

like image 169
tommueller Avatar answered Sep 30 '22 19:09

tommueller