Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
oren opened this issue Oct 5, 2015 · 19 comments
Closed

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

oren opened this issue Oct 5, 2015 · 19 comments

Comments

@oren
Copy link

oren commented Oct 5, 2015

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?

@wez
Copy link
Contributor

wez commented Oct 5, 2015

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

@oren
Copy link
Author

oren commented Oct 5, 2015

👍

@oren oren closed this as completed Oct 5, 2015
@gabouh
Copy link

gabouh commented Dec 14, 2015

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
:)

@yottanami
Copy link

Why do I need to change the these parameters everytime?

@ssomnoremac
Copy link

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

@wez
Copy link
Contributor

wez commented Dec 16, 2015

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

@eladcandroid
Copy link

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

@wez
Copy link
Contributor

wez commented Jun 6, 2016

@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.

@eladcandroid
Copy link

@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

@adeelibr
Copy link

adeelibr commented Sep 5, 2016

thankyou @eladcandroid this fixed my problem

@yottanami
Copy link

It can be useful

https://github.com/guard/listen/wiki/Increasing-the-amount-of-inotify-watchers

@tundeojediran
Copy link

Problem fixed. Thank you @eladcandroid

@victoriastuart
Copy link

victoriastuart commented Feb 23, 2017

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

@longhorn09
Copy link

longhorn09 commented Jun 8, 2017

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

@victoriastuart
Copy link

victoriastuart commented Jun 8, 2017

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

@jandiralceu
Copy link

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

@schmitt-kevin
Copy link

schmitt-kevin commented Mar 23, 2018

just a simple

sudo sysctl -p

cmd worked for me

@cpmech
Copy link

cpmech commented Sep 21, 2018

@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..

@barretogustavo
Copy link

Thanks eladcandroid ! Solve my problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests