getappmap / appmap-js

Client libraries for AppMap
48 stars 17 forks source link

Indexer exits with Error: ENOSPC: System limit for number of file watchers reached #894

Closed symwell closed 1 year ago

symwell commented 1 year ago

Tracking as a separate issue this error first described in https://github.com/getappmap/appmap-js/issues/881.

Error: ENOSPC: System limit for number of file watchers reached, watch 'venv/lib/python3.10/site-packages/plotly/validators/isosurface/lighting/__pycache__'
at FSWatcher.<computed> (node:internal/fs/watchers:244:19)
at Object.watch (node:fs:2251:34)
at createFsWatchInstance (/home/user/.config/Code/User/globalStorage/appland.appmap/node_modules/chokidar/lib/nodefs-handler.js:119:15)
at setFsWatchListener (/home/user/.config/Code/User/globalStorage/appland.appmap/node_modules/chokidar/lib/nodefs-handler.js:166:15)
at NodeFsHandler._watchWithNodeFs (/home/user/.config/Code/User/globalStorage/appland.appmap/node_modules/chokidar/lib/nodefs-handler.js:331:14)
at NodeFsHandler._handleDir (/home/user/.config/Code/User/globalStorage/appland.appmap/node_modules/chokidar/lib/nodefs-handler.js:567:19)
at process.processTicksAndRejections (node:internal/process/task_queues:96:5)
at async NodeFsHandler._addToNodeFs (/home/user/.config/Code/User/globalStorage/appland.appmap/node_modules/chokidar/lib/nodefs-handler.js:617:16)
Emitted 'error' event on FSWatcher instance at:
at FSWatcher._handleError (/home/user/.config/Code/User/globalStorage/appland.appmap/node_modules/chokidar/index.js:647:10)
at NodeFsHandler._addToNodeFs (/home/user/.config/Code/User/globalStorage/appland.appmap/node_modules/chokidar/lib/nodefs-handler.js:645:18)
at process.processTicksAndRejections (node:internal/process/task_queues:96:5) {
errno: -28,
syscall: 'watch',
code: 'ENOSPC',
path: 'venv/lib/python3.10/site-packages/plotly/validators/isosurface/lighting/__pycache__',
filename: 'venv/lib/python3.10/site-packages/plotly/validators/isosurface/lighting/__pycache__'
}

I was able to reproduce it as described here. This occurs from watching too many files and a limit in the kernel. This limit can't be changed without root privileges.

symwell commented 1 year ago

Note the file watched was lighting/__pycache__. Should probably add __pycache__ in the list of ignored files.

symwell commented 1 year ago

Got the same error with the scanner

$ yarn run scanner scan --watch --appmap-dir ~/tmp/too_many_open_files
Using scanner configuration file /home/test/src/appmap-js/packages/scanner/built/sampleConfig/default.yml
node:internal/errors:484
    ErrorCaptureStackTrace(err);
    ^

Error: ENOSPC: System limit for number of file watchers reached, watch '/home/test/tmp/too_many_open_files/requests3/1670264573_5802293_http_www_example_com_password_resets.appmap.json'
    at FSWatcher.<computed> (node:internal/fs/watchers:244:19)
    at Object.watch (node:fs:2315:34)
    at createFsWatchInstance (/home/test/src/appmap-js/node_modules/chokidar/lib/nodefs-handler.js:119:15)
    at setFsWatchListener (/home/test/src/appmap-js/node_modules/chokidar/lib/nodefs-handler.js:166:15)
    at NodeFsHandler._watchWithNodeFs (/home/test/src/appmap-js/node_modules/chokidar/lib/nodefs-handler.js:331:14)
    at NodeFsHandler._handleFile (/home/test/src/appmap-js/node_modules/chokidar/lib/nodefs-handler.js:395:23)
    at NodeFsHandler._addToNodeFs (/home/test/src/appmap-js/node_modules/chokidar/lib/nodefs-handler.js:637:21)
Emitted 'error' event on FSWatcher instance at:
    at FSWatcher._handleError (/home/test/src/appmap-js/node_modules/chokidar/index.js:647:10)
    at NodeFsHandler._addToNodeFs (/home/test/src/appmap-js/node_modules/chokidar/lib/nodefs-handler.js:645:18) {
  errno: -28,
  syscall: 'watch',
  code: 'ENOSPC',
  path: '/home/test/tmp/too_many_open_files/requests3/1670264573_5802293_http_www_example_com_password_resets.appmap.json',
  filename: '/home/test/tmp/too_many_open_files/requests3/1670264573_5802293_http_www_example_com_password_resets.appmap.json'
}

Node.js v18.8.0
appland-release commented 1 year ago

:tada: This issue has been resolved in version @appland/appmap-v3.53.1 :tada:

The release is available on:

Your semantic-release bot :package::rocket: