Cypress: Cypress crashing on Linux > System limit for number of file watchers reached 'package.json'

Created on 7 Apr 2020  路  3Comments  路  Source: cypress-io/cypress

Hi, daily user of Cypress here.
Just found this corner case where Cypress.js is crashing.

Steps to reproduce

Not exactly sure but overall this is the scenario.

  1. Open a bunch of processes which subscribe to package.json changes. In my case: two WebStorm windows & react build tools
  2. Open Cypress, open the project directory and run all tests in Chrome
  3. Cypress will crash right after opening Chrome with the following output:

Cypress process output

 {
  errno: -28,
  syscall: 'watch',
  code: 'ENOSPC',
  path: '/home/jake/DEV/dedupe-refresh/package.json',
  filename: '/home/jake/DEV/dedupe-refresh/package.json'
}
Error: ENOSPC: System limit for number of file watchers reached, watch '/home/jake/DEV/dedupe-refresh/package.json'
    at FSWatcher.start (internal/fs/watchers.js:165:26)
    at Object.watch (fs.js:1329:11)
    at createFsWatchInstance (/home/jake/.cache/Cypress/4.3.0/Cypress/resources/app/packages/server/node_modules/watchify/node_modules/chokidar/lib/nodefs-handler.js:38:15)
    at setFsWatchListener (/home/jake/.cache/Cypress/4.3.0/Cypress/resources/app/packages/server/node_modules/watchify/node_modules/chokidar/lib/nodefs-handler.js:81:15)
    at FSWatcher.NodeFsHandler._watchWithNodeFs (/home/jake/.cache/Cypress/4.3.0/Cypress/resources/app/packages/server/node_modules/watchify/node_modules/chokidar/lib/nodefs-handler.js:233:14)
    at FSWatcher.NodeFsHandler._handleFile (/home/jake/.cache/Cypress/4.3.0/Cypress/resources/app/packages/server/node_modules/watchify/node_modules/chokidar/lib/nodefs-handler.js:262:21)
    at FSWatcher.<anonymous> (/home/jake/.cache/Cypress/4.3.0/Cypress/resources/app/packages/server/node_modules/watchify/node_modules/chokidar/lib/nodefs-handler.js:495:21)
    at callback (/home/jake/.cache/Cypress/4.3.0/Cypress/resources/app/packages/server/node_modules/graceful-fs/polyfills.js:289:20)
    at FSReqCallback.oncomplete (fs.js:159:5)

GET /__cypress/tests?p=cypress/support/index.js-271 - - ms - -
GET /__cypress/tests?p=cypress/integration/2.rwandaAllDedupes.test.js-101 - - ms - -
GET /__cypress/tests?p=cypress/integration/1.filterOptions.test.js-697 - - ms - -
/home/jake/.cache/Cypress/4.3.0/Cypress/Cypress --no-sandbox -- --cwd /home/jake/DEV/dedupe-refresh[19436]: ../../third_party/electron_node/src/node_platform.cc:449:std::shared_ptr<PerIsolatePlatformData> node::NodePlatform::ForIsolate(v8::Isolate *): Assertion `data' failed.
The Test Runner unexpectedly exited via a exit event with signal SIGABRT

Please search Cypress documentation for possible solutions:

https://on.cypress.io

Check if there is a GitHub issue describing this crash:

https://github.com/cypress-io/cypress/issues

Consider opening a new issue.

----------

Platform: linux (Ubuntu Linux - 19.10)
Cypress Version: 4.3.0

System

Ubuntu 19.10
Cypress 4.3.0
node.js v12.16.1


Thanks! I love cypress. Let me know if I can provide more info.

Most helpful comment

Also, FYI, I have file watching explicitly disabled in cypress.json, but it's still crashing:

{
  "baseUrl": "http://localhost:3003",
  "watchForFileChanges": false,
  "defaultCommandTimeout": 10000
}

All 3 comments

I'd suggest increasing the limit for the number of file watchers your system can watch https://github.com/guard/listen/wiki/Increasing-the-amount-of-inotify-watchers#the-technical-details

@jennifer-shehane True, I am going to do that.

However, I'd suggest the expected behavior should be not to crash the entire process over this.

Also, FYI, I have file watching explicitly disabled in cypress.json, but it's still crashing:

{
  "baseUrl": "http://localhost:3003",
  "watchForFileChanges": false,
  "defaultCommandTimeout": 10000
}
Was this page helpful?
0 / 5 - 0 ratings