Scenario
Sytem: linux (ubuntu 22.04)
When there are too many open inotify instances the parcel build will hung without any clue to why it's stuck.
Expected behavior
Parcel should throw clear exception - e.g. "There are too many open files, cannot initialize inotify instance"
Stretch goal
Suggest to user what are possible actions to fix it (e.g. writing higher value to /proc/sys/fs/inotify/max_user_instances).
Current behavior
When there are too many open inotify instances the inotify_init1 returns -1 with errno "Too many open files". This causes exception in InotifyBackend: https://github.com/parcel-bundler/watcher/blob/master/src/linux/InotifyBackend.cc#L25.
When this happens the Backend::run will block forever due to insufficient error handling (https://github.com/parcel-bundler/watcher/blob/master/src/Backend.cc#L103):

The fix will require a bit more than just calling mStartedSignal.notify() (error needs to be populated up the stack) - the above just highlights in what state the process ends up when this error happens.
Steps to reproduce
- Setup simple parcel project (package.json + src/index.js is sufficient)
- Set
/proc/sys/fs/inotify/max_user_instances to some small value (e.g. 1)
- Run parcel build
- Parcel will hung forever:
> my-library@1.0.0 build
> parcel build
Workaround
Naturally the problem of too many inotify instances needs to be fixed (even when this bug will be resolved) - either by closing old processes in system or by increasing the limit echo 256 | sudo tee /proc/sys/fs/inotify/max_user_instances (default is often 128).
Scenario
Sytem: linux (ubuntu 22.04)
When there are too many open inotify instances the
parcel buildwill hung without any clue to why it's stuck.Expected behavior
Parcel should throw clear exception - e.g. "There are too many open files, cannot initialize inotify instance"
Stretch goal
Suggest to user what are possible actions to fix it (e.g. writing higher value to
/proc/sys/fs/inotify/max_user_instances).Current behavior
When there are too many open inotify instances the inotify_init1 returns -1 with errno "Too many open files". This causes exception in InotifyBackend: https://github.com/parcel-bundler/watcher/blob/master/src/linux/InotifyBackend.cc#L25.
When this happens the
Backend::runwill block forever due to insufficient error handling (https://github.com/parcel-bundler/watcher/blob/master/src/Backend.cc#L103):The fix will require a bit more than just calling
mStartedSignal.notify()(error needs to be populated up the stack) - the above just highlights in what state the process ends up when this error happens.Steps to reproduce
/proc/sys/fs/inotify/max_user_instancesto some small value (e.g. 1)Workaround
Naturally the problem of too many inotify instances needs to be fixed (even when this bug will be resolved) - either by closing old processes in system or by increasing the limit
echo 256 | sudo tee /proc/sys/fs/inotify/max_user_instances(default is often 128).