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

Too many open files - Failed to initialize inotify: the user limit on the total number of inotify instances has been reached. #23

Closed
cordawyn opened this issue Jan 11, 2013 · 15 comments

Comments

@cordawyn
Copy link

Every now and then [guard] fails to start with the following message:

11:21:41 - INFO - Guard is now watching at '/home/cordawyn/Projects/test'
/home/cordawyn/.rvm/gems/ruby-1.9.3-p327-turbo/gems/rb-inotify-0.8.8/lib/rb-inotify/notifier.rb:66:in `initialize': Too many open files - Failed to initialize inotify: the user limit on the total number of inotify instances has been reached. (Errno::EMFILE)

This happens after returning the computer (notebook) from sleep mode, then launching guard (on a Rails project). To make things worse, it is not 100% reproducible (I'd say, around 80% of attempts).

I figure this might not be exactly rb-notify's bug, but rather that of either inotify or a million other kernel subsystems, but guard+rb-notify seems to be the only combo that manages to surface this issue. If you could point me to a more appropriate responsible party, it would be much appreciated ;-)

@nex3
Copy link
Collaborator

nex3 commented Jan 11, 2013

I don't know who the right person to talk to about this, but I also don't know of anything we can do in rb-inotify to solve the issue 😕. Sorry.

@nex3 nex3 closed this as completed Jan 11, 2013
@sevenseacat
Copy link

anything we can do to fix the problem would be nice :/ it happens to me randomly and persists until I reboot my computer.

@hron
Copy link
Contributor

hron commented Jan 23, 2013

I've just stumbled upon the same problem. I think this issue could be not relate to rb-inotify, but the tools we use on our computers. I just tried to increase a limit of user instances. Here is the link with more info:

http://unix.stackexchange.com/questions/13751/kernel-inotify-watch-limit-reached

I had to increase this:

echo 256 > /proc/sys/fs/inotify/max_user_instances

@deric
Copy link

deric commented Jan 26, 2013

thanks @hron it solved the issue for me

@sevenseacat
Copy link

not for me, unfortunately - I still get the error. Oh well.

@zewelor
Copy link

zewelor commented Jan 30, 2013

@Karpah echo 256 > /proc/sys/fs/inotify/max_user_instances , try to increase the value, i got now 600, before 512 was working good, it looks like each time I restart guard ( kill and start again ) I had to increase it (?)

@zewelor
Copy link

zewelor commented Jan 30, 2013

I found that quote here: http://irclog.whitequark.org/ruby-lang/2012-03-29

16:11 <Defusal> now i can't even test anymore, rb-inotifier does not automatically close inotify handles, so if you dont manually do it, such as when the app doesn't exit cleanly, the handles are left open on the kernel forever...
16:11 <Defusal> so now its maxed out my user limit for inotify
16:11 <Defusal> Exception: Too many open files - Failed to initialize inotify: the user limit on the total number of inotify instances has been reached.
16:13 <Defusal> so between EventMachine crashing ruby and rb-inotifier, it's really screwed me over

@nex3
Copy link
Collaborator

nex3 commented Feb 22, 2013

I'm surprised that the OS doesn't clean up handles that are held by processes that have died. I'm not aware of a way to clean them up manually in the face of the process crashing.

@srusskih
Copy link

srusskih commented Mar 8, 2013

Hi
Are there any news about the issue?

@nex3
Copy link
Collaborator

nex3 commented Mar 8, 2013

I'm still unaware of any way to handle this in rb-inotify itself.

@srusskih
Copy link

srusskih commented Mar 9, 2013

I catch this issue when my PC had been worked for a week with turned guard on and without reboot.
Also we can compare libs/kernel versions

@paradisaeidae
Copy link

I suspect the Linux kernel header for inotify has changed, so the inotify.so needs a recompile?
I am trying to find inotify.c to recompile it.
Though I do not see it in this repo.
Any clues?

@paradisaeidae
Copy link

Could not find inotify.c so moving to: https://github.com/nex3/rb-inotify

@kokizzu
Copy link

kokizzu commented Aug 21, 2013

yup, that solves my issues

# increase inotify file watch limit
ofile=/proc/sys/fs/inotify/max_user_instances
sudo sh -c "echo 8192 > $ofile"
cat $ofile
rerun app.rb

@ShuangxuQiu
Copy link

I've just stumbled upon the same problem. I think this issue could be not relate to rb-inotify, but the tools we use on our computers. I just tried to increase a limit of user instances. Here is the link with more info:

http://unix.stackexchange.com/questions/13751/kernel-inotify-watch-limit-reached

I had to increase this:

echo 256 > /proc/sys/fs/inotify/max_user_instances

works for me,thx

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

10 participants