Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'Aw, Snap' error screen shown when test runs over 250 seconds (approx) intermittant #1906

Closed
sswales opened this issue Jun 8, 2018 · 71 comments

Comments

@sswales
Copy link

sswales commented Jun 8, 2018

Current behavior:

Cypress when tests seem to run over 200 seconds you are sometimes presented with a screen showing the following:

'Aw, Snap! Something went wrong while displaying this webpage. Learn More / Reload'

Screenshot:

Desired behavior:

Shouldn't timeout.

Steps to reproduce:

Runs tests around 300s plus using the Chrome browser.

Versions

Version: 2.1.0 to 3.0.2

@sswales
Copy link
Author

sswales commented Jul 2, 2018

Just checked and this seems to be even more of an issue in 3.0.2

@sswales
Copy link
Author

sswales commented Jul 2, 2018

So just to give a bit more information so this can be looked into further...

The issue seems to be happening less back on 2.1.0, it increased in 3.0.1 and is happening more often in 3.0.2.

Not sure what has been introduced an updated since 3.0.1+ but it's getting worse, it occurs when running over 200s although there isn't a specific time as it varies.

@dylanarmstrong
Copy link

@shaunswales have you found any workarounds for this yet? I'm running into this on 3.0.2 as well.

@AlexanderGranhof
Copy link

same issue, was able to reach ~2100 seconds at one point, but generally crashes around 200-300 seconds

@Prashant-Kan
Copy link

Same issue
sometimes facing Aw snap and sometimes it crashes my application server to run further due to which it throws response timeout error.

@asubota
Copy link

asubota commented Aug 2, 2018

+1 same story

@Prashant-Kan
Copy link

Prashant-Kan commented Aug 2, 2018

Hello,

I have tried few solution and it is working for me at the moment but I am still in testing mode with different scenario.

In Cypress.json

{
    "requestTimeout" : 30000,
    "numTestsKeptInMemory": 0,
    "responseTimeout" : 50000,
    "pageLoadTimeout": 100000
}

This is what I have changed.
Anyone who face the same issue try this one.

I got reference from MySameQuestion
and some quick research on default timeout values.

@carloscheddar
Copy link

carloscheddar commented Aug 2, 2018

Happening to me as well but only for cypress open. cypress run --browser chrome doesn't have the same issue.

Edit

The issue started happening with --browser chrome as well.

@Prashant-Kan
Copy link

Prashant-Kan commented Aug 2, 2018

Try adding

{
"numTestsKeptInMemory": 0,
}

In your cypress.json. Browser will not crash. It will work.

@patpatx
Copy link

patpatx commented Aug 14, 2018

Happening to me as well.

As mentioned by @Prashant-Kan, changing "numTestsKeptInMemory": 0, does help prevent the Aw, Snap from appearing. 👍 Thanks for that tip.

Do note that by setting numTestsKeptInMemory to 0, this itself disables the snapshot / limit the capability of Command Log feature.

Just wondering, as I notice Cypress runner saves the snapshot temporarily on the memory, isn't it possible to save it to a file (maybe an option) instead every x MB/test, so as to limit/lessen the possibility of Aw snap memory problem

@duncan-bayne
Copy link

We're experiencing this consistently with a long-running test that visits different SaaS systems. It gets towards the end of the test, then crashes Chrome w/ the 'Aw, Snap' message.

  • Cypress 3.1.0
  • Chrome Version 68.0.3440.106 (Official Build) (64-bit)
  • macOS High Sierra 10.13.2

@duncan-bayne
Copy link

Some further updates:

  1. The workaround proposed by @Prashant-Kan doesn't prevent the crash in our case.
  2. The crash happens every time, not intermittently.
  3. If we reduce our test case to the minimal "browse to site, enter username and password, log in" then Chrome still crashes. Happens on OSX and Windows.

I think this is a different bug, & will raise as a new issue.

@Prashant-Kan
Copy link

Hi, duncan-bayne:

I got reference from MySameQuestion
and some quick research on default timeout values.

Check the explanation in the above-mentioned link maybe you will get your solution.

@Boczarsky
Copy link

Hello,

I have tried few solution and it is working for me at the moment but I am still in testing mode with different scenario.

In Cypress.json

{
    "requestTimeout" : 30000,
    "numTestsKeptInMemory": 0,
    "responseTimeout" : 50000,
    "pageLoadTimeout": 100000
}

This is what I have changed.
Anyone who face the same issue try this one.

I got reference from MySameQuestion
and some quick research on default timeout values.

It isn't work for me. Browser still crashes during long tests.

@Prashant-Kan
Copy link

@Boczarsky : Correct, Even it fails for me too (now) earlier it was getting passed. But, When my number of steps for the particular testcases increases which eventually increases the Memory, which results in browser crash.

if, Anyone else faces this issue and has the solution please do guide us.

@B3Kay
Copy link

B3Kay commented Dec 27, 2018

This is a big issue at our department where we are doing big end to end testing as we can't do tests taking longer then 250s...

@jennifer-shehane
Copy link
Member

Unfortunately we'll have to close this issue if no reproducible example is provided. Can anyone provide a way to reproduce this?

@jennifer-shehane jennifer-shehane added the stage: needs information Not enough info to reproduce the issue label Jan 8, 2019
@azollai
Copy link

azollai commented Feb 21, 2019

@jennifer-shehane the problem is still appearing in version 3.1.5.
Reproduce it by running a spec file for more than 5 minutes. You can use a simple demo app and put a for loop around it.

@jennifer-shehane
Copy link
Member

jennifer-shehane commented Mar 1, 2019

@azollai I've been unable to reproduce this using your suggestion. My example ran for 569 seconds.

We will need the issue narrowed down more - to specifically what to run to reproduce it.

My test code:

let times = 1000

for (let i = 0; i < times; i++) {
  it('.focus() - focus on a DOM element', () => {
    cy.visit('https://example.cypress.io/commands/actions')
    cy.get('.action-focus').focus()
      .should('have.class', 'focus')
      .prev().should('have.attr', 'style', 'color: orange;')
  })
}

screen shot 2019-03-01 at 4 46 02 pm

Edited by @jennifer-shehane - Added correct screenshot.

@Saibamen
Copy link
Contributor

Saibamen commented Mar 2, 2019

@jennifer-shehane: This is Cypress 3.1.5 or unreleased Cypress 4? What is Attempt 1 and Attempt 2 buttons (labels?)?

@EduMotaControliD
Copy link

EduMotaControliD commented Mar 7, 2019

@jennifer-shehane: I have the same problem, I'm running only a inserts of users on a form, it work fine whether I set only litle numbers of users but if I increase that number like 30 or more the browser break. The browser also break when I try to run a bunch of tests, like 6 or more tests, which make others things. I'm running cypress in windows with git bash.

My cypress.json

{
"animationDistanceThreshold": 5,
"baseUrl": "http://localhost:30445",
"blacklistHosts": null,
"chromeWebSecurity": true,
"defaultCommandTimeout": 4000,
"env": {},
"execTimeout": 60000,
"fileServerFolder": "",
"fixturesFolder": "cypress/fixtures",
"hosts": null,
"integrationFolder": "cypress/integration",
"modifyObstructiveCode": true,
"numTestsKeptInMemory": 0,
"pageLoadTimeout": 100000,
"pluginsFile": "cypress/plugins",
"port": null,
"reporter": "spec",
"reporterOptions": null,
"requestTimeout": 30000,
"responseTimeout": 50000,
"screenshotsFolder": "cypress/screenshots",
"supportFile": "cypress/support",
"taskTimeout": 60000,
"testFiles": "**/*.*",
"trashAssetsBeforeRuns": true,
"userAgent": null,
"video": true,
"videoCompression": 32,
"videoUploadOnPasses": true,
"videosFolder": "cypress/videos",
"viewportHeight": 660,
"viewportWidth": 1000,
"waitForAnimations": true,
"watchForFileChanges": true
}

Version output

$ npx cypress version                                                                                                                                                                                           Cypress package version: 3.1.5                                                                                                                                                                                  Cypress binary version: 3.1.5

My set test

it('Login', function ()
    {
        cy.visit('http://localhost:30445/#/login')
        cy.get('#usr').type('My_username')
        cy.get('#pwd').type('My_password')
        cy.get('#confirm').click()
    })

it('Set Users', function ()
    {
        cy.get('#listuser').click()
      
       for(var i =0; i < 300; i++)
       {
        cy.get('#addUser').click()
        cy.get('#name').type(`User Test ${i + 1}`)
        cy.get('#btnConfirm').click()
        }
})

@jennifer-shehane
Copy link
Member

@Saibamen Whoops, this is the wrong screenshot. 😅 This is some work we are doing getting ready for test retries. #1313

@jennifer-shehane
Copy link
Member

@EduMotaControliD Is there any way to provide some tests that break that we can run locally?

@Phillipe-Bojorquez
Copy link

Phillipe-Bojorquez commented Mar 8, 2019

This happens to me if I am running tests through the GUI and select run all specs. I have 10 specs each one taking 1-3 minutes to run a piece. I get 3/4ths done and get oh snap errors. For me, it doesn't matter how long an individual test is running but a group of specs running over a certain time limit crashes my app. I am uncertain how to share my tests since they concern private things my company would not like me to share. Is there a way to spy on the error message for the GUI test runner that could help debug it?

my spec files have one describe block with a before each block and many it blocks underneath it. Our site does polling so during the tests there may be graphql queries being fired while i interact with the site.

edit: the browser crashes after 5 minutes but is unresponsive to scrolling the left panel at around 3.5 minutes.

@carloscheddar
Copy link

I found that having the dev tools open allows chrome to catch the out-of-memory error which causes the browser to pause(debugger state) instead of showing aw snap. If you wait a bit for memory to be available then you can click on the play button and the tests will continue. It's not ideal but at least I can finish testing the file.

@juristr
Copy link

juristr commented Apr 24, 2019

Suffering the same issue. Apparently the "numTestsKeptInMemory": 0, solves it for me (at least for now)

@sswales
Copy link
Author

sswales commented Apr 24, 2019

Sorry I didn't realise this was still open, yes that is what I needed to implement.

The reason being within windows the application is a 32-bit application, with the tests kept in memory this meant that everything within the DOM for each action was stored. This eventually went over the memory limit for a 32-bit application.

@richtera
Copy link

richtera commented May 5, 2022

Argh even Elektron is not 100% reliably and shows an empty screen unless I manually execute one test script at a time using --watch

@b-pmcg
Copy link

b-pmcg commented May 6, 2022

Try adding

{
"numTestsKeptInMemory": 0,
}

In your cypress.json. Browser will not crash. It will work.

I found this issue in Chrome 95 with Cypress 8.7

I suggest anyone else to use this solution.

This solution doesn't work if you want to review and debug failing tests in the browser

@richtera
Copy link

richtera commented May 6, 2022

@b-pmcg using numTestsKeptInMemory is unfortunately not a useful solution because if you're running with --watch then you need to keep the snapshots which cause the problems to see anything (especially because 0 won't even keep the currently failing set of snapshots in memory.) I have not actually seen the error when not running with --watch in which case snapshots are also not required, but then without video and combing through those videos it's difficult to develop test scripts. I think there needs to be a better solution or a way to save and restore snapshots from disk. Another thing that might be good is to be able to run several tests (not all) but be able to select a few, run them and see the results. Basically I have about 40 tests which will fail if I run them all, but if I run one at a time I will be there about 1/2 hour. It would be nice to be able to run 20 and then run another 20 without needing to change the code to skip some and not others. Then I can easily exclude the tests that take up too much memory and run them at the end separately.

@burkedavid
Copy link

burkedavid commented May 12, 2022

Getting this regularly with long test runs in Chrome locally. all the below set

"numTestsKeptInMemory": 0,
"video": false,
"defaultCommandTimeout": 10000,

@laerteneto
Copy link

Getting this as well with

"numTestsKeptInMemory": 10,
"video": true,
"defaultCommandTimeout": 15000,

@ezrag26
Copy link

ezrag26 commented Aug 2, 2022

Still happening on 10.3.0. I can't get through more than 5 minutes of tests before Chrome runs out of memory.

@navdeepdevrepublic
Copy link

navdeepdevrepublic commented Aug 7, 2022

Still happening on 10.3.0. I can't get through more than 5 minutes of tests before Chrome runs out of memory.

I have raised this new issue for the same context (Cypress 10.4.0) #23131

@kolorfilm
Copy link

same problem with the lastest cypress version :-(

@Prashant-Kan
Copy link

Same problem since cypress v8.3
I think this requires urgent look
because its getting worse when we have to use numTestsKeptInMemory:0 every time

jinh0 added a commit to DDMAL/Neon that referenced this issue Aug 9, 2022
In regards to the reselect-dragged-fix, I added checks on whether the element is reselected after it has been dragged.

One other thing that has been changed in this commit is:

Drag tests have been crashing, and I think it's due to the sheer number of them in one file. I also set `numTestsKeptInMemory` to 0, which may help with this crashing issue.

Related: cypress-io/cypress#1906
@SinghPramender
Copy link

Same problem is happening in the version 9.7.0 and unable to run my test cases in headed mode. Need to fix this issues.
image

@navdeepdevrepublic
Copy link

navdeepdevrepublic commented Aug 22, 2022

#23193 #23131 Tickets for same issue @SinghPramender

@chughes87
Copy link

My team was struggling with this issue recently. We found that using Chrome 94 (instead of 104) resolved the issue for us.

@theTestingApproach
Copy link

Got this issue today with cypress 9.5.2..I have 16 specs and it crashed in the 10th one. This happened when using the cypress GUI..If any other details is needed pls let me know.

@howard-zhang
Copy link

howard-zhang commented Aug 26, 2022

Got this issue with Cypress 8.4.1 and the runner crashed with out of memory error after running a couple of tests out of 12 total tests. The same file ran okay before.

@mehran75
Copy link

Same issue

@JohnSmithyy
Copy link

Same issue and I tried all the solutions users posted above.

@CoryDanielson
Copy link
Contributor

There appears to be a bug with Chrome 104 that has reduced memory limits for a tab (possibly). One of the comments even mentions Cypress crashing in 104, but not 103

You may also benefit from running garbage collection between tests, if you aren't already. For cypress 10+ users, the changes recommended here are different because of the Cypress changes to the plugins file.

@JohnSmithyy
Copy link

There appears to be a bug with Chrome 104 that has reduced memory limits for a tab (possibly). One of the comments even mentions Cypress crashing in 104, but not 103

You may also benefit from running garbage collection between tests, if you aren't already. For cypress 10+ users, the changes recommended here are different because of the Cypress changes to the plugins file.

Enabling garbage collection between tests have not worked either unfortunately.

@DomyNithanth
Copy link

DomyNithanth commented Aug 31, 2022

@CoryDanielson
I was getting this Out of memory 'Aw, Snap' issue for the past two weeks starting from 10th Aug 2022 to be exact. Current Cypress version : 10.3.0.
After that, used the numTestsKeptInMemory: 0 in config and it did work for a while, but after few days the issue was observed again frequently.

On further observation it was observed that, chrome version used was 104 from 10th Aug 2022 and until that date it was 103.
This observation validates the issue with chrome 104

@CoryDanielson
Copy link
Contributor

CoryDanielson commented Aug 31, 2022

See this issue for more details. This is the only open issue related to this on Cypress at the moment

I saw somewhere that Chrome 105, and 106 canary still have the same issue. So it may be a while before this is resolved.

Downgrading to Chrome 103 is temporary work around

@scorpyto
Copy link

scorpyto commented Apr 5, 2023

Today the issue still persists. Latest version of Cypress - v12.9.0, latest version of Chrome - v111. Running tests for more than 5 mins causes the "Aw snap" error. Please, you need to find a stable solution for cypress open. It is not suitable for a big project when people are relying on automation tests...

@burkedavid
Copy link

Today the issue still persists. Latest version of Cypress - v12.9.0, latest version of Chrome - v111. Running tests for more than 5 mins causes the "Aw snap" error. Please, you need to find a stable solution for cypress open. It is not suitable for a big project when people are relying on automation tests...

@scorpyto maybe try experimentalMemoryManagement: true in cypress.config.js ?

@scorpyto
Copy link

scorpyto commented Apr 5, 2023

@scorpyto maybe try experimentalMemoryManagement: true in cypress.config.js ?

already Implemented :/

@nagash77
Copy link
Contributor

nagash77 commented Apr 5, 2023

Hi @scorpyto Can you please open a new issue for your specific use case with a reproducible example? We will be happy to look at that.

@scorpyto
Copy link

scorpyto commented Apr 7, 2023

Hi @scorpyto Can you please open a new issue for your specific use case with a reproducible example? We will be happy to look at that.

"experimentalMemoryManagement": true didn't help but
"numTestsKeptInMemory ": 0 seems to work fine at the moment (35 mins tests). Will try later with more tests.
My mistake was that it was set to:
"numTestsKeptInMemory ": true

@aream-tebra
Copy link

Same problem. Adding numTestsKeptInMemory=0 in cypress.config.js fixed it (default is 50). Full instructions & example here:
https://docs.cypress.io/guides/references/configuration

@Xiomycm15
Copy link

Xiomycm15 commented Oct 20, 2024

Hi I am also facing this problem. I added "numTestsKeptInMemory ": 0 in the cypres.config.js this way and now happily working:

const { defineConfig } = require("cypress");
const cucumber = require('cypress-cucumber-preprocessor').default

module.exports = defineConfig({
  numTestsKeptInMemory: 0,
  e2e: {
    setupNodeEvents(on, config) {
      // implement node event listeners here
      on('file:preprocessor', cucumber())
    },
    specPattern: "cypress/e2e/Features/*.feature",
  },
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests