facebook / watchman

Watches files and records, or triggers actions, when they change.

Home Page:https://facebook.github.io/watchman/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

The user limit on the total number of inotify watches was reached

oren opened this issue · comments

commented

System info

cat /etc/lsb-release
DISTRIB_DESCRIPTION="Ubuntu 15.04"

uname -a
Linux oren 3.19.0-15-generic #15-Ubuntu SMP Thu Apr 16 23:32:37 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

lscpu | grep "Model name"
Intel(R) Core(TM) i7-3667U CPU @ 2.00GHz

free -h
total       used       free     shared    buffers     cached
Mem:          7.5G       5.7G       1.8G       168M       1.0G       3.0G
-/+ buffers/cache:       1.7G       5.8G
Swap:         7.7G         0B       7.7G

Install watchman

sudo apt-get install automake python-dev
git clone https://github.com/facebook/watchman.git
cd watchman
git checkout v3.7.0
./autogen.sh
./configure
make
sudo make install

Create hello world react-native (here is the git repo)

react-native init hello
cd hello
npm start

output

> hello@0.0.1 start /home/oren/projects/react-native/hello
> node_modules/react-native/packager/packager.sh

 ┌────────────────────────────────────────────────────────────────────────────┐
 │  Running packager on port 8081.                                            │
 │                                                                            │
 │  Keep this packager running while developing on any JS projects. Feel      │
 │  free to close this tab and run your own packager instance if you          │
 │  prefer.                                                                   │
 │                                                                            │
 │  https://github.com/facebook/react-native                                  │
 │                                                                            │
 └────────────────────────────────────────────────────────────────────────────┘
Looking for JS files in
   /home/oren/projects/react-native/hello


React packager ready.

 ERROR  A non-recoverable condition has triggered.  Watchman needs your help!
The triggering condition was at timestamp=1444001279: inotify-add-watch(/home/oren/projects/react-native/HackerNews-React-Native/node_modules/react-native/node_modules/yeoman-generator/node_modules/download/node_modules/caw/node_modules/get-proxy/node_modules/rc/node_modules/.bin) -> The user limit on the total number of inotify watches was reached; increase the fs.inotify.max_user_watches sysctl
All requests will continue to fail with this message until you resolve
the underlying problem.  You will find more information on fixing this at
https://facebook.github.io/watchman/docs/troubleshooting.html#poison-inotify-add-watch

{"watchmanResponse":{"version":"3.7.0","error":"A non-recoverable condition has triggered.  Watchman needs your help!\nThe triggering condition was at timestamp=1444001279: inotify-add-watch(/home/oren/projects/react-native/HackerNews-React-Native/node_modules/react-native/node_modules/yeoman-generator/node_modules/download/node_modules/caw/node_modules/get-proxy/node_modules/rc/node_modules/.bin) -> The user limit on the total number of inotify watches was reached; increase the fs.inotify.max_user_watches sysctl\nAll requests will continue to fail with this message until you resolve\nthe underlying problem.  You will find more information on fixing this at\nhttps://facebook.github.io/watchman/docs/troubleshooting.html#poison-inotify-add-watch\n"}}
Error: A non-recoverable condition has triggered.  Watchman needs your help!
The triggering condition was at timestamp=1444001279: inotify-add-watch(/home/oren/projects/react-native/HackerNews-React-Native/node_modules/react-native/node_modules/yeoman-generator/node_modules/download/node_modules/caw/node_modules/get-proxy/node_modules/rc/node_modules/.bin) -> The user limit on the total number of inotify watches was reached; increase the fs.inotify.max_user_watches sysctl
All requests will continue to fail with this message until you resolve
the underlying problem.  You will find more information on fixing this at
https://facebook.github.io/watchman/docs/troubleshooting.html#poison-inotify-add-watch

    at ChildProcess.<anonymous> (/home/oren/projects/react-native/hello/node_modules/react-native/node_modules/sane/node_modules/fb-watchman/index.js:202:17)
    at emitTwo (events.js:87:13)
    at ChildProcess.emit (events.js:172:7)
    at maybeClose (internal/child_process.js:817:16)
    at Socket.<anonymous> (internal/child_process.js:319:11)
    at emitOne (events.js:77:13)
    at Socket.emit (events.js:169:7)
    at Pipe._onclose (net.js:469:12)

I Increased max_user_watches, max_queued_events, and max_user_instances

echo 999999 | sudo tee -a /proc/sys/fs/inotify/max_user_watches
echo 999999 | sudo tee -a /proc/sys/fs/inotify/max_queued_events
echo 999999 | sudo tee -a /proc/sys/fs/inotify/max_user_instances

But I still get the same error. Any ideas?

After increasing the limits, you need to run watchman shutdown-server as the poison state is sticky.
https://facebook.github.io/watchman/docs/troubleshooting.html#i-39-ve-changed-my-limits-how-can-i-clear-the-error

commented

👍

echo 999999 | sudo tee -a /proc/sys/fs/inotify/max_user_watches && echo 999999 | sudo tee -a /proc/sys/fs/inotify/max_queued_events && echo 999999 | sudo tee -a /proc/sys/fs/inotify/max_user_instances && watchman shutdown-server
:)

Why do I need to change the these parameters everytime?

Just want to add this was still an issue (after everything above) when running

sudo npm start

better to chown any files that are su owned. In my case .babel.json

@yottanami every time you reboot? You need to persist your configuration for sysctl in /etc/sysctl.conf; take a look at man 8 sysctl

@wez I didn't understand what to do to save the state also after reboot

@eladcandroid It is usually managed by /etc/sysctl.conf but it may depend on your linux distribution. You should google for something like "ubuntu sysctl save" if you're using ubuntu.

@wez Thanks. Now I've found it:
https://github.com/guard/listen/wiki/Increasing-the-amount-of-inotify-watchers

Here is the full command that sets a high limit and makes it permanent:

echo 999999 | sudo tee -a /proc/sys/fs/inotify/max_user_watches && echo 999999 | sudo tee -a /proc/sys/fs/inotify/max_queued_events && echo 999999 | sudo tee -a /proc/sys/fs/inotify/max_user_instances && watchman shutdown-server && sudo sysctl -p

thankyou @eladcandroid this fixed my problem

Problem fixed. Thank you @eladcandroid

Arch Linux:

  • "... The user limit on the total number of inotify watches was reached; increase the fs.inotify.max_user_watches sysctl ..."

  • Change to 10,000,000:

sudo echo 10000000 | sudo tee /proc/sys/fs/inotify/max_user_watches

I tried a number of suggestions in this thread which worked temporarily, but the changes didn't persist after reboot.
One technique that worked for me is appending to /etc/sysctl.conf. I run Ubuntu 16.04.

fs.inotify.max_user_watches = 999999
fs.inotify.max_queued_events = 999999
fs.inotify.max_user_instances = 999999

You can also view the values using
sudo sysctl fs.inotify.max_user_watches fs.inotify.max_queued_events fs.inotify.max_user_instances

Hi! You can add this to cron/crontab, as shown further below:

  • Install inotify [Arch Linux]:

    sudo pacman -Syu
    sudo pacman -S inotify-tools


  • Issue: Krusader (file manager) views were not auto-refreshing

    cat /proc/sys/fs/inotify/max_user_watches
    8192

    echo 100000000 | sudo tee /proc/sys/fs/inotify/max_user_watches ## 100,000,000
    100000000

    cat /proc/sys/fs/inotify/max_user_watches
    100000000


  • Added as entry (every minute) in crontab:

    # m h dom mon dow user nice command

    # "At every minute" [http://crontab.guru/]:
    * * * * * root nice -n 19 sudo echo 100000000 | sudo tee /proc/sys/fs/inotify/max_user_watches

    # 100000000 : 100,000,000
    # verify: cat /proc/sys/fs/inotify/max_user_watches

Solve my problem! thanks @longhorn09 !!!!!

just a simple

sudo sysctl -p

cmd worked for me

@wez Thanks. Now I've found it:
https://github.com/guard/listen/wiki/Increasing-the-amount-of-inotify-watchers

Here is the full command that sets a high limit and makes it permanent:

echo 999999 | sudo tee -a /proc/sys/fs/inotify/max_user_watches && echo 999999 | sudo tee -a /proc/sys/fs/inotify/max_queued_events && echo 999999 | sudo tee -a /proc/sys/fs/inotify/max_user_instances && watchman shutdown-server && sudo sysctl -p

I just don't need watchman shutdown-server. It is not available on Ubtuntu 18.04..

Thanks eladcandroid ! Solve my problem.