cypress: Cypress 7. Component tests. File limit reached error is shown on CI
Current behavior
Since we upgraded to version 7.4.0 from 6.2.1 this warning is shown
On some VMs it’s even failing with error, I guess it’s depending on some system configuration
Error: ENOSPC: System limit for number of file watchers reached, watch 'cypress/component'
https://github.com/Visual-Regression-Tracker/frontend/runs/2961008538#step:4:191
seems like webpack 5 config issue
should we even watch files during run-ct?
Test code to reproduce
https://github.com/Visual-Regression-Tracker/frontend
Versions
Cypress 7.4.0
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 12
- Comments: 17 (8 by maintainers)
Here are my findings. I used the react-multi-crop from @berviantoleo (see this comment) to test and debug, since it consistently exhibits the file limit error on
cypress@7.7.0, but works fine oncypress@7.6.0.Isolating the Problem
To isolate the problem, I ran the same pipeline on both GH Actions and CircleCI - this problem only manifests on GH Actions, which in my experience, have less powerful machines than CircleCI. Is everyone experiencing this problem on GH Actions? Are you able to reproduce locally? If you are experiencing it locally, are you running in docker? I’m trying to narrow the problem down, I suspect it’s a docker (or a docker-in-github-actions) problem. @pashidlos @ckxddd0324 @Asharma86 @andrico1234.
Fixing the Problem (7.6.0 -> 7.7.0)
I diff
cypress@7.6.0andcypress@7.7.0and found that this line is causing the problem, at least in thereact-multi-cropexample. Betweencypress@7.6.0andcypress@7.7.0, I removed a check which causes an additional spec watcher to start in E2E mode. 🤦 This watcher should not start incypress run, onlycypress open, so I made a PR fixing that.Seems the file limit error is a problem for @pashidlos in
cypress@7.4.0, so the PR I made probably won’t solve that problem, but it’s a good start and should help some people out who encountered problems when upgrading fromcypress@7.6.0.Other Solutions (Chokidar pollling)
For other readers, until we find a more sustainable solution (such as @pashidlos, who has this problem pre
cypress@7.6.0) I found around work-around might be useful to you. Here’s some more information i found regarding GH Actions, docker and watching files, which points out the underlying problem is “you are watching too many files”. To watch less files withchokidar(which is what Cypress, and basically every other Node.js based tool uses) we can use theusePollingoption. It fixes the problem in thereact-multi-cropexample. You could give that a try and see if it works - it’s working forreact-multi-crop:react-multi-cropfailing with Cypress 7.7.0,CHOKIDAR_USEPOLLING: 0(default is 0) https://github.com/lmiller1990/react-multi-crop/runs/3168834559?check_suite_focus=true#step:7:56react-multi-croppassing with Cypress 7.7.0,CHOKIDAR_USEPOLLING: 1https://github.com/lmiller1990/react-multi-crop/runs/3168920083?check_suite_focus=true#step:7:113Here’s how you can use the
CHOKIDAR_USEPOLLING: 1option: https://github.com/lmiller1990/react-multi-crop/commit/9ad840a175ec58c3c127f552b52a9a94d051d64bSeems like this is fixed.
If it comes up again or in another context, please make a new issue! Thanks team.
@pashidlos, @jennifer-shehane , this is happening for my team as well and I commented on a closed issue so this comment is to connect both issues.
https://github.com/cypress-io/cypress/issues/6960#issuecomment-884197117
cc: @adi518, @sterling, @ckxddd0324, @jakub-bao
Please wait for the next release and see if that fixes your problem. In the meantime, you could try the
CHOKIDARwork around. I’d say using the dashboard is not relevant here, I think the problem is related to the CI provider.@lmiller1990 thanks for extensive description!
first time I discovered this issue with
7.4.0running inside docker on internal company CI (TeamCity) and we were managed to solve that (I guess as described here) so unfortunately I could not reproduce it anymore with7.4.0those were the logsthe second time it was on
GH Actionswith7.6.0and it’s fixed with your workaroundI ended up downgrading and running it with the command above and it worked. Cypress clearly has a bug somewhere. I’d close this issue to avoid duplication though.
Thanks for tagging me this! Hope Cypress can solve this with a quick hot-fix
Thanks @adi518 for sharing the workaround - it worked for me. Hope Cypress can update us here once it is fixed.
cc: @jennifer-shehane
I’m having a similar issue,
Even with
"watchForFileChanges": false,set in the cypress.json, running"yarn cypress run --record --ci-build-id #{Build.BuildNumber}# --group '#{Build.DefinitionName}#'"in our CI pipeline throws the same warnings and errors that @pashidlos shared.