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

OSError: Cannot initialize new instance of inotify, Errno=Too many open files (EMFILE) #23

Open
MikhailKasimov opened this issue Oct 9, 2018 · 3 comments

Comments

@MikhailKasimov
Copy link

Hello!

Have got such multiple trace in server's log:

Exception in thread Thread-1:
Traceback (most recent call last):
  File "/usr/lib64/python2.7/threading.py", line 812, in __bootstrap_inner
    self.run()
  File "/usr/lib/python2.7/site-packages/pyinotify.py", line 1511, in run
    self.loop()
  File "/usr/lib/python2.7/site-packages/pyinotify.py", line 1497, in loop
    self.process_events()
  File "/usr/lib/python2.7/site-packages/pyinotify.py", line 1295, in process_events
    self._default_proc_fun(revent)
  File "/usr/lib/python2.7/site-packages/pyinotify.py", line 937, in __call__
    return _ProcessEvent.__call__(self, event)
  File "/usr/lib/python2.7/site-packages/pyinotify.py", line 662, in __call__
    return meth(event)
  File "/root/Watcher/watcher.py", line 247, in process_IN_CREATE
    self.runCommand(event)
  File "/root/Watcher/watcher.py", line 227, in runCommand
    prefix)
  File "/root/Watcher/watcher.py", line 300, in addWatch
    wm = pyinotify.WatchManager()
  File "/usr/lib/python2.7/site-packages/pyinotify.py", line 1747, in __init__
    raise OSError(err % self._inotify_wrapper.str_errno())
OSError: Cannot initialize new instance of inotify, Errno=Too many open files (EMFILE)

Need some hint on further investigation here. Thanks!

@gregghz
Copy link
Owner

gregghz commented Nov 9, 2018

It would probably be useful to figure out what open files are on your server (I would google this problem for your specific platform -- there are ways to increase the limit on linux, but it might be distro dependent).

Posting your config for watcher would be helpful too.

@andygikling
Copy link

andygikling commented May 21, 2021

This is a common problem on Linux systems in my experience. You can just sidestep it. But @gregghz has an important point - you should understand why you're out of inotify handles.

https://stackoverflow.com/questions/32281277/too-many-open-files-failed-to-initialize-inotify-the-user-limit-on-the-total

or

$ cat /proc/sys/fs/inotify/max_user_instances
$ sudo sh -c "echo 8192 > /proc/sys/fs/inotify/max_user_instances"

@apton-marimanohar
Copy link

This is a common problem on Linux systems in my experience. You can just sidestep it. But @gregghz has an important point - you should understand why you're out of inotify handles.

https://stackoverflow.com/questions/32281277/too-many-open-files-failed-to-initialize-inotify-the-user-limit-on-the-total

or

$ cat /proc/sys/fs/inotify/max_user_instances $ sudo sh -c "echo 8192 > /proc/sys/fs/inotify/max_user_instances"

@andygikling its working now

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

4 participants