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

Memory leak in long running single test #4164

Closed
Konstruktour opened this issue May 8, 2019 · 5 comments

Comments

4 participants
@Konstruktour
Copy link

commented May 8, 2019

Current behavior:

Currently if a test runs the same actions repetitively over a long period of time, the memory of the cypress process increases until it crashes. (headless mode, video off, numTestsKeptInMemory 0)
The sample to reproduce runs 15 minutes increasing the memory ~300MB. (the longer the run the more memory is used..)

Desired behavior:

Performance tests should be possible with cypress, without increasing memory and crashing.

Steps to reproduce: (app code and test code)

Config cypress.json

{
  "baseUrl": "http://localhost:8080/",
  "defaultCommandTimeout": 60000,
  "viewportWidth": 1280,
  "viewportHeight": 720,
  "numTestsKeptInMemory": 0,
  "video": false
}

Cypress test

describe('memory dummy test', () => {
    const endTime = Date.now() + 60000 * 15;

    before('visit', () => {
        cy.visit('/memory-test.html');
    });

    it('should test', () => {
        const test = () => {
            cy.get('#testinput').clear().type('hello world');
            cy.wait(2000);
            cy.then(() => {
                if (Date.now() < endTime) test();
            });
        };
        test();
    });
});

Simple static html site

<!DOCTYPE html>
<html lang="en">
<head>
</head>
<body>
	<input id="testinput">
</body>
</html>

Versions

Cypress 3.2.0
Windows 10

@scharf

This comment has been minimized.

Copy link

commented Jun 16, 2019

@brian-mann

This comment has been minimized.

Copy link
Member

commented Jun 17, 2019

I actually believe this issue will be fixed by this PR which will be merged in the next patch release: #4406

@brian-mann

This comment has been minimized.

Copy link
Member

commented Jun 17, 2019

It was an oversight / bug that we were still taking snapshots when a single test even though numSnapshotsKeptInMemory was 0 - so it's expected that the memory would grow larger after each command runs - until the next test runs.

@brian-mann

This comment has been minimized.

Copy link
Member

commented Jun 17, 2019

Closing this issue as duplicate because I'm very confident this is describing the same behavior as #4104

@cypress-bot

This comment has been minimized.

Copy link

commented Jun 27, 2019

Released in 3.3.2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.