catberry / catberry-assets

Plugin for Catberry Framework that builds assets for every cat-component using Gulp.
Other
5 stars 0 forks source link

No need watch in node_modules, failing with ENOSPC #18

Closed imShara closed 7 years ago

imShara commented 7 years ago
<...>

[2016-12-22T00:51:07.442Z] [FATAL] [catberry:30047] – Error: watch /home/user/foo/bar/node_modules/orchestrator/node_modules/end-of-stream ENOSPC
    at exports._errnoException (util.js:1022:11)
    at FSWatcher.start (fs.js:1305:19)
    at Object.fs.watch (fs.js:1330:11)
    at createFsWatchInstance (/home/user/foo/bar/node_modules/chokidar/lib/nodefs-handler.js:37:15)
    at setFsWatchListener (/home/user/foo/bar/node_modules/chokidar/lib/nodefs-handler.js:80:15)
    at FSWatcher.NodeFsHandler._watchWithNodeFs (/home/user/foo/bar/node_modules/chokidar/lib/nodefs-handler.js:228:14)
    at FSWatcher.NodeFsHandler._handleDir (/home/user/foo/bar/node_modules/chokidar/lib/nodefs-handler.js:407:19)
    at FSWatcher.<anonymous> (/home/user/foo/bar/node_modules/chokidar/lib/nodefs-handler.js:455:19)
    at FSWatcher.<anonymous> (/home/user/foo/bar/node_modules/chokidar/lib/nodefs-handler.js:460:16)
    at FSReqWrap.oncomplete (fs.js:111:15)

[2016-12-22T00:51:07.442Z] [FATAL] [catberry:30047] – Error: watch /home/user/foo/bar/node_modules/orchestrator/node_modules/once ENOSPC
    at exports._errnoException (util.js:1022:11)
    at FSWatcher.start (fs.js:1305:19)
    at Object.fs.watch (fs.js:1330:11)
    at createFsWatchInstance (/home/user/foo/bar/node_modules/chokidar/lib/nodefs-handler.js:37:15)
    at setFsWatchListener (/home/user/foo/bar/node_modules/chokidar/lib/nodefs-handler.js:80:15)
    at FSWatcher.NodeFsHandler._watchWithNodeFs (/home/user/foo/bar/node_modules/chokidar/lib/nodefs-handler.js:228:14)
    at FSWatcher.NodeFsHandler._handleDir (/home/user/foo/bar/node_modules/chokidar/lib/nodefs-handler.js:407:19)
    at FSWatcher.<anonymous> (/home/user/foo/bar/node_modules/chokidar/lib/nodefs-handler.js:455:19)
    at FSWatcher.<anonymous> (/home/user/foo/bar/node_modules/chokidar/lib/nodefs-handler.js:460:16)
    at FSReqWrap.oncomplete (fs.js:111:15)

<...>

Dirty fix - increase max_user_watches per user

echo fs.inotify.max_user_watches=500000 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
rdner commented 7 years ago

Thanks for pointing this out. What makes you think it's catberry-assets related?

imShara commented 7 years ago

What makes you think it's catberry-assets related?

Sorry, that's not about catberry-assets. The problem is in dependency — csstime.

imShara commented 7 years ago

This issue was moved to csstime/csstime-gulp-tasks#36

rdner commented 7 years ago

I think it's an internal catberry watcher that rebuilds the browser bundle, not a gulp tasks plugin either.

imShara commented 7 years ago

Problem appears after log message "starting assets building".

rdner commented 7 years ago

But does it still happen if you disable the assets plugin?

imShara commented 7 years ago

UPD. Made some tests. If you limit max_user_watches, the problem should appear in clean catberry example:

echo fs.inotify.max_user_watches=1000 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p

Why need to watch node_modules directory? No one makes changes in it while debug.

rdner commented 7 years ago

Catberry does not watch node_modules directory, of course. It watches only for changes in catberry_components and catberry_stores directories. However, Catberry uses browserify+watchify and the last one watches any file included to the bundle.js for changes. It could cause such problem if you had a really huge graph of dependencies in your app.

You can find the implementation of the entire process here https://github.com/catberry/catberry/blob/develop/lib/builders/BrowserBundleBuilder.js

I suspect you included some huge amount of files to the bundle by accident. There are very big apps built using Catberry and nobody had this issue before.