-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
Cypress 10 component test crash after 100~ tests #22208
Comments
Hey, thanks for the feedback. Interesting... I wondered if this is CI-related memory issue, but you get the same thing both locally and on CI? Or, perhaps, a memory leak somewhere and the browser has a hard limit. I'm guessing this is not an open source repo - are you able to share some info, maybe We have several projects but none running 100+ specs in a single shot - they run in parallel in separate containers, which is perhaps why we didn't hit this. If you could provide some more info, that'd be great - in the meantime I will try to make a project on my machine that has a bunch of specs and see what happens. |
Same thing is happening to me. Here the cypress.config.js:
And the package.json:
I omitted a couple of details from the file that were confidential ,but I think this has the gist of it. |
Ok, I think I'm on to something. I ran the tests with chrome and not electron and they passed, three times in a row. So, perhaps it might be something related with electron? 🤷 |
Interesting - that's really useful info, we are always running on Chrome in CI as well for our component tests. This is useful info for @AtofStryker who's looking into this, but running in Chrome seems like a good work around for now, especially if you are developing a web app, since that's what most people will be using to consume your components. Electrons apps are definitely a thing though, so it'd be nice to isolate what exactly the difference in between electron vs chrome. They should be quite similar, all things considered. Next step for debugging would probably be seeing what happens in Chromium. |
Hey @gvocale. Sorry for the delay in getting to this issue. I am having some trouble reproducing the error. I created a reproduction repository here similar to @JoaoTMDias 's configuration (I took a guess at the webpack config) and was unable to reproduce with |
@AtofStryker the reproduction works correctly without errors on my localhost. I updated packages to latest and re-run When running ERR_FAILED (-2) loading 'http://localhost:8080/__/#/specs/runner?file=src/dct/components/Checkout/Payment/Query/test.tsx'
Error: ERR_FAILED (-2) loading 'http://localhost:8080/__/#/specs/runner?file=src/dct/components/Checkout/Payment/Query/test.tsx'
at rejectAndCleanup (node:electron/js2c/browser_init:161:7647)
at EventEmitter.stopLoadingListener (node:electron/js2c/browser_init:161:8022)
at EventEmitter.emit (node:events:390:28)
at EventEmitter.emit (node:domain:475:12)
Unhandled rejection Error: ERR_FAILED (-2) loading 'about:blank'
at rejectAndCleanup (node:electron/js2c/browser_init:161:7647)
at EventEmitter.stopLoadingListener (node:electron/js2c/browser_init:161:8022)
at EventEmitter.emit (node:events:390:28)
at EventEmitter.emit (node:domain:475:12) |
@gvocale when you say "updated packages to latest" do you mean in the reproduction repository or the original posted code?
By default it should run in |
@AtofStryker I have just tried running ERR_FAILED (-2) loading 'http://localhost:8080/__/#/specs/runner?file=src/dct/components/Checkout/Payment/Query/test.tsx'
Error: ERR_FAILED (-2) loading 'http://localhost:8080/__/#/specs/runner?file=src/dct/components/Checkout/Payment/Query/test.tsx'
at rejectAndCleanup (node:electron/js2c/browser_init:161:7647)
at EventEmitter.stopLoadingListener (node:electron/js2c/browser_init:161:8022)
at EventEmitter.emit (node:events:390:28)
at EventEmitter.emit (node:domain:475:12)
────────────────────────────────────────────────────────────────────────────────────────────────────
Running: test.tsx (190 of 230)
Unhandled rejection Error: ERR_FAILED (-2) loading 'about:blank'
at rejectAndCleanup (node:electron/js2c/browser_init:161:7647)
at EventEmitter.stopLoadingListener (node:electron/js2c/browser_init:161:8022)
at EventEmitter.emit (node:events:390:28)
at EventEmitter.emit (node:domain:475:12) |
@gvocale can you see if the same thing happens in chrome (on CI and locally?)
There are some other issues that look like they'll be fixed when we update to Electron 19 - this might be one of them. If Chrome has the same problem, we will know it's not related to Electron, and can dig deeper. |
@lmiller1990 running |
Good to know it's an electron issue. I wouldn't say chrome fixes it - it just avoids it, haha. We have some work coming soon to update the electron version we use, maybe that will fix this issue. Until then, I'm going to hold off on looking into this. If the electron 19.x bump doesn't fix it, I'll take another look. |
ERR_FAILED (-2) loading 'http://localhost:8080/__/#/specs/runner?file=src/dct/components/Checkout/Payment/Query/Query.cy.tsx'
Error: ERR_FAILED (-2) loading 'http://localhost:8080/__/#/specs/runner?file=src/dct/components/Checkout/Payment/Query/Query.cy.tsx'
at rejectAndCleanup (node:electron/js2c/browser_init:161:7647)
at EventEmitter.stopLoadingListener (node:electron/js2c/browser_init:161:8022)
at EventEmitter.emit (node:events:390:28)
at EventEmitter.emit (node:domain:475:12)
Unhandled rejection Error: ERR_FAILED (-2) loading 'about:blank'
at rejectAndCleanup (node:electron/js2c/browser_init:161:7647)
at EventEmitter.stopLoadingListener (node:electron/js2c/browser_init:161:8022)
at EventEmitter.emit (node:events:390:28)
at EventEmitter.emit (node:domain:475:12)
error Command failed with exit code 1. Ops! I was running in Electron on the CI |
Can you try the latest Cypress (10.2.0)? This PR landed which might help with memory issues: #22460 |
@lmiller1990 still running in the issue on electron with |
Right, I thought it went out already. Let's wait for the next release. Thanks. |
@gvocale, could you try cypress 10.3.0 to see if it resolves your issue? A contributor recently fixed a memory leak. |
@mjhenkes no luck, failing on cy when using electron with
|
Argh, no luck. I'll try to reproduce. @JoaoTMDias I noticed you have |
Thanks! That would be something that document would be helpful to read when I was migrating 🙂 |
I'm trying to reproduce this by running a lot of CT specs: https://github.com/lmiller1990/cra-cypresss-lots-of-specs/runs/7121846709?check_suite_focus=true. We need a reliable reproduction to debug this. I tried reproducing: https://github.com/lmiller1990/cra-cypresss-lots-of-specs/actions/runs/2586378690. Super basic test, but there's 100 specs, each runs 10 tests - no dice. Edit: dup of #22353? |
Closing as a duplicate of #22353 |
Same as #22663 I think! |
I am still running into this issue regularly when running tests in CI on the latest version (10.6.0). Given that we're building an electron app, we don't want to use Chrome to resolve these issues (even though they're basically the same). It appears the aforementioned electron upgrade hasn't fixed this problem. For more context, here's an example of what we're running into (it's slightly different, so maybe warrants a new issue, but the loading about:blank is still present)
|
Hi @panzarino, long time no see. Question... is this for component testing (as the issue suggests) or E2E? If it is indeed component testing, out of curiosity can you try using the |
Yeah this is only happening on component testing (e2e has no problems) - I'll give that experimental option a try and see if it fixes anything. Not sure if it matters, but sometimes we get failures like this for our first spec, sometimes for last, sometimes somewhere in the middle. I'm not sure if the errors are always the same (I'll try to report any different ones), but about half of all component test runs in CI are currently failing for things outside of our control like this. |
Hmm ok, thanks for the context. I just checked and we run all ours in Chrome - I'll try running in Electron, I'm guessing we will see the same problem. I wonder why this only manifests in Electron... I wonder if either we have an Electron-specific memory leak, or there's a memory leak due to how we use Electron. If it was a memory issue, I'd expect it to be more consistent (like the original OP described) not random, though. |
This error is popping up for me in a GitLab SaaS runner when running with the electron browser, with only 15 component tests. I believe it is resource related. Those runners have 1vCPU and 3.75gb of memory. When I run tests locally in the same docker container the runner is using, and constrain it to those specs, the error consistently appears. When I give the container a bit more juice the errors go away. Possibly related, but I am seeing what looks like tests running before the webpack finishes compilation with electron. Cypress tries to connect to the electron browser, times out, and then I see |
I think it's fine to connect to the browser while webpack is compiling - Cypress will wait until webpack compiles to actually run the tests, but no need to block on bundling while the browser opens. Are you able to share a docker container than reproduces this consistently? That would greatly help with debugging. I also think it's a resource issue. Most of my projects are using Vite, so I don't notice it - I wonder if webpack is more of a memory hog 🤔 |
Current behavior
Both on CI and on localhost, after running a hundred component tests (i.e. 138 of 227) via
cypress run --component
, Cypress 10 would fail with the following error:If I run the failing test via
cypress open
it passes correctly.If I comment out the component test that provoked the error, another one will trip with the same error, usually around the same ~120 of ... 227 number.
Desired behavior
All component tests should run correctly
Test code to reproduce
Doesn't matter...event the following fails:
Cypress Version
10.0.3
Other
No response
The text was updated successfully, but these errors were encountered: