rb-inotify: ERROR -- : run() in thread failed: stream closed:\n rb-inotify-0.9.8/lib/rb-inotify/notifier.rb:304:in `readpartial'

Discussed here: https://github.com/guard/guard/issues/833

Apparently fixed here: https://github.com/e2/rb-inotify/commits/misc_bugfixes

Specifically https://github.com/e2/rb-inotify/commit/be4cf88b4dab0bb3a899b16a0df8a6fcf1502e16

Full error:

E, [2017-03-21T14:09:06.413770 #10019] ERROR -- : run() in thread failed: stream closed:\n /home/samuel/.rvm/gems/ruby-2.4.0/gems/rb-inotify-0.9.8/lib/rb-inotify/notifier.rb:304:in `readpartial'
/home/samuel/.rvm/gems/ruby-2.4.0/gems/rb-inotify-0.9.8/lib/rb-inotify/notifier.rb:304:in `readpartial'
/home/samuel/.rvm/gems/ruby-2.4.0/gems/rb-inotify-0.9.8/lib/rb-inotify/notifier.rb:275:in `read_events'
/home/samuel/.rvm/gems/ruby-2.4.0/gems/rb-inotify-0.9.8/lib/rb-inotify/notifier.rb:242:in `process'
/home/samuel/.rvm/gems/ruby-2.4.0/gems/rb-inotify-0.9.8/lib/rb-inotify/notifier.rb:225:in `run'
/home/samuel/.rvm/gems/ruby-2.4.0/gems/listen-3.1.5/lib/listen/adapter/linux.rb:39:in `_run'
/home/samuel/.rvm/gems/ruby-2.4.0/gems/listen-3.1.5/lib/listen/adapter/base.rb:78:in `block in start'
/home/samuel/.rvm/gems/ruby-2.4.0/gems/listen-3.1.5/lib/listen/internals/thread_pool.rb:6:in `block in add'\n\ncalled from:\n /home/samuel/.rvm/gems/ruby-2.4.0/gems/listen-3.1.5/lib/listen/listener.rb:68:in `block in <class:Listener>'
/home/samuel/.rvm/gems/ruby-2.4.0/gems/listen-3.1.5/lib/listen/fsm.rb:121:in `instance_eval'
/home/samuel/.rvm/gems/ruby-2.4.0/gems/listen-3.1.5/lib/listen/fsm.rb:121:in `call'
/home/samuel/.rvm/gems/ruby-2.4.0/gems/listen-3.1.5/lib/listen/fsm.rb:91:in `transition_with_callbacks!'
/home/samuel/.rvm/gems/ruby-2.4.0/gems/listen-3.1.5/lib/listen/fsm.rb:57:in `transition'
/home/samuel/.rvm/gems/ruby-2.4.0/gems/listen-3.1.5/lib/listen/listener.rb:91:in `start'
/home/samuel/.rvm/gems/ruby-2.4.0/gems/guard-2.14.1/lib/guard/commander.rb:35:in `start'
/home/samuel/.rvm/gems/ruby-2.4.0/gems/guard-2.14.1/lib/guard/cli/environments/valid.rb:16:in `start_guard'
/home/samuel/.rvm/gems/ruby-2.4.0/gems/guard-2.14.1/lib/guard/cli.rb:122:in `start'
/home/samuel/.rvm/gems/ruby-2.4.0/gems/thor-0.19.4/lib/thor/command.rb:27:in `run'
/home/samuel/.rvm/gems/ruby-2.4.0/gems/thor-0.19.4/lib/thor/invocation.rb:126:in `invoke_command'
/home/samuel/.rvm/gems/ruby-2.4.0/gems/thor-0.19.4/lib/thor.rb:369:in `dispatch'
/home/samuel/.rvm/gems/ruby-2.4.0/gems/thor-0.19.4/lib/thor/base.rb:444:in `start'
/home/samuel/.rvm/gems/ruby-2.4.0/gems/guard-2.14.1/lib/guard/aruba_adapter.rb:32:in `execute'
/home/samuel/.rvm/gems/ruby-2.4.0/gems/guard-2.14.1/lib/guard/aruba_adapter.rb:19:in `execute!'
/home/samuel/.rvm/gems/ruby-2.4.0/gems/guard-2.14.1/bin/_guard-core:11:in `<main>'

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 21 (9 by maintainers)

Most upvoted comments

I fixed issue with inotify event queue has overflowed on Ubuntu 16.04 by appending this to /etc/sysctl.conf

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

Hi everybody!

I think I still have this issue, and I can’t manage to solve it. I am working on Manjaro 18.0.2 . I applied all the possible methods to “increase the amount of inotify watchers”, and here is my output for sudo sysctl --system :

* Applying /usr/lib/sysctl.d/10-manjaro.conf ...
fs.inotify.max_user_instances = 999999
fs.inotify.max_queued_events = 999999
fs.inotify.max_user_watches = 999999
* Applying /usr/lib/sysctl.d/50-coredump.conf ...
kernel.core_pattern = |/usr/lib/systemd/systemd-coredump %P %u %g %s %t %c %h %e
* Applying /usr/lib/sysctl.d/50-default.conf ...
kernel.sysrq = 1
kernel.core_uses_pid = 1
net.ipv4.conf.all.rp_filter = 1
net.ipv4.conf.all.accept_source_route = 0
net.ipv4.conf.all.promote_secondaries = 1
net.core.default_qdisc = fq_codel
fs.protected_hardlinks = 0
fs.protected_symlinks = 0

ruby -v :

jruby 9.2.5.0 (2.5.0) 2018-12-06 6d5a228 OpenJDK 64-Bit Server VM 25.192-b26 on 1.8.0_192-b26 +jit [linux-x86_64]

I am using rails 5.2.2 and listen 3.1.5 gems.

Notice that everything seems to work normally, but even running “bin/rails -h” spams hundreds of lines or errors, and that’s quite annoying actually. 😕

Any help would be really appreciated!

Error example :

E, [2019-02-05T08:08:37.122880 #6306] ERROR -- : run() in thread failed: closed stream:\n org/jruby/RubyIO.java:3549:in `select'
org/jruby/RubyKernel.java:665:in `select'
/home/paulbreugnot/.rvm/gems/jruby-9.2.5.0/gems/rb-inotify-0.10.0/lib/rb-inotify/notifier.rb:306:in `readpartial'
/home/paulbreugnot/.rvm/gems/jruby-9.2.5.0/gems/rb-inotify-0.10.0/lib/rb-inotify/notifier.rb:279:in `read_events'
/home/paulbreugnot/.rvm/gems/jruby-9.2.5.0/gems/rb-inotify-0.10.0/lib/rb-inotify/notifier.rb:252:in `process'
/home/paulbreugnot/.rvm/gems/jruby-9.2.5.0/gems/rb-inotify-0.10.0/lib/rb-inotify/notifier.rb:229:in `block in run'
org/jruby/ext/thread/Mutex.java:159:in `synchronize'
/home/paulbreugnot/.rvm/gems/jruby-9.2.5.0/gems/rb-inotify-0.10.0/lib/rb-inotify/notifier.rb:226:in `run'
/home/paulbreugnot/.rvm/gems/jruby-9.2.5.0/gems/listen-3.1.5/lib/listen/adapter/linux.rb:39:in `_run'
/home/paulbreugnot/.rvm/gems/jruby-9.2.5.0/gems/listen-3.1.5/lib/listen/adapter/base.rb:78:in `block in start'
/home/paulbreugnot/.rvm/gems/jruby-9.2.5.0/gems/listen-3.1.5/lib/listen/internals/thread_pool.rb:6:in `block in add'\n\ncalled from:\n /home/paulbreugnot/.rvm/rubies/jruby-9.2.5.0/lib/ruby/stdlib/forwardable.rb:229:in `start'
/home/paulbreugnot/.rvm/gems/jruby-9.2.5.0/gems/listen-3.1.5/lib/listen/listener.rb:68:in `block in Listener'
/home/paulbreugnot/.rvm/gems/jruby-9.2.5.0/gems/listen-3.1.5/lib/listen/fsm.rb:121:in `instance_eval'
/home/paulbreugnot/.rvm/gems/jruby-9.2.5.0/gems/listen-3.1.5/lib/listen/fsm.rb:121:in `call'
/home/paulbreugnot/.rvm/gems/jruby-9.2.5.0/gems/listen-3.1.5/lib/listen/fsm.rb:91:in `transition_with_callbacks!'
/home/paulbreugnot/.rvm/gems/jruby-9.2.5.0/gems/listen-3.1.5/lib/listen/fsm.rb:57:in `transition'
/home/paulbreugnot/.rvm/gems/jruby-9.2.5.0/gems/listen-3.1.5/lib/listen/listener.rb:91:in `start'
/home/paulbreugnot/.rvm/gems/jruby-9.2.5.0/gems/activesupport-5.2.2/lib/active_support/evented_file_update_checker.rb:96:in `boot!'
/home/paulbreugnot/.rvm/gems/jruby-9.2.5.0/gems/activesupport-5.2.2/lib/active_support/evented_file_update_checker.rb:67:in `initialize'
/home/paulbreugnot/.rvm/gems/jruby-9.2.5.0/gems/railties-5.2.2/lib/rails/application/finisher.rb:166:in `block in Finisher'
/home/paulbreugnot/.rvm/gems/jruby-9.2.5.0/gems/railties-5.2.2/lib/rails/initializable.rb:32:in `instance_exec'
/home/paulbreugnot/.rvm/gems/jruby-9.2.5.0/gems/railties-5.2.2/lib/rails/initializable.rb:32:in `run'
/home/paulbreugnot/.rvm/gems/jruby-9.2.5.0/gems/railties-5.2.2/lib/rails/initializable.rb:61:in `block in run_initializers'
/home/paulbreugnot/.rvm/rubies/jruby-9.2.5.0/lib/ruby/stdlib/tsort.rb:228:in `block in tsort_each'
/home/paulbreugnot/.rvm/rubies/jruby-9.2.5.0/lib/ruby/stdlib/tsort.rb:350:in `block in each_strongly_connected_component'
/home/paulbreugnot/.rvm/rubies/jruby-9.2.5.0/lib/ruby/stdlib/tsort.rb:431:in `each_strongly_connected_component_from'
/home/paulbreugnot/.rvm/rubies/jruby-9.2.5.0/lib/ruby/stdlib/tsort.rb:349:in `block in each_strongly_connected_component'
/home/paulbreugnot/.rvm/rubies/jruby-9.2.5.0/lib/ruby/stdlib/tsort.rb:347:in `call'
/home/paulbreugnot/.rvm/rubies/jruby-9.2.5.0/lib/ruby/stdlib/tsort.rb:347:in `each_strongly_connected_component'
/home/paulbreugnot/.rvm/rubies/jruby-9.2.5.0/lib/ruby/stdlib/tsort.rb:226:in `tsort_each'
/home/paulbreugnot/.rvm/rubies/jruby-9.2.5.0/lib/ruby/stdlib/tsort.rb:205:in `tsort_each'
/home/paulbreugnot/.rvm/gems/jruby-9.2.5.0/gems/railties-5.2.2/lib/rails/initializable.rb:60:in `run_initializers'
/home/paulbreugnot/.rvm/gems/jruby-9.2.5.0/gems/railties-5.2.2/lib/rails/application.rb:361:in `initialize!'
/home/paulbreugnot/Development/Ruby/workspace/blog/config/environment.rb:5:in `<main>'
/home/paulbreugnot/.rvm/gems/jruby-9.2.5.0/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:291:in `block in require'
/home/paulbreugnot/.rvm/gems/jruby-9.2.5.0/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:291:in `block in require'
/home/paulbreugnot/.rvm/gems/jruby-9.2.5.0/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:257:in `load_dependency'
/home/paulbreugnot/.rvm/gems/jruby-9.2.5.0/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:291:in `require'
/home/paulbreugnot/.rvm/gems/jruby-9.2.5.0/gems/railties-5.2.2/lib/rails/application.rb:1:in `(root)'
/home/paulbreugnot/.rvm/gems/jruby-9.2.5.0/gems/railties-5.2.2/lib/rails/application.rb:337:in `require_environment!'
/home/paulbreugnot/.rvm/gems/jruby-9.2.5.0/gems/railties-5.2.2/lib/rails/command/actions.rb:18:in `require_application_and_environment!'
/home/paulbreugnot/.rvm/gems/jruby-9.2.5.0/gems/railties-5.2.2/lib/rails/commands/rake/rake_command.rb:33:in `rake_tasks'
/home/paulbreugnot/.rvm/gems/jruby-9.2.5.0/gems/railties-5.2.2/lib/rails/commands/rake/rake_command.rb:42:in `formatted_rake_tasks'
/home/paulbreugnot/.rvm/gems/jruby-9.2.5.0/gems/railties-5.2.2/lib/rails/commands/rake/rake_command.rb:12:in `block in flat_map'
/home/paulbreugnot/.rvm/gems/jruby-9.2.5.0/gems/railties-5.2.2/lib/rails/commands/rake/rake_command.rb:12:in `block in printing_commands'
/home/paulbreugnot/.rvm/gems/jruby-9.2.5.0/gems/railties-5.2.2/lib/rails/command.rb:93:in `transform_values!'
/home/paulbreugnot/.rvm/gems/jruby-9.2.5.0/gems/railties-5.2.2/lib/rails/command.rb:93:in `sorted_groups'
/home/paulbreugnot/.rvm/gems/jruby-9.2.5.0/gems/railties-5.2.2/lib/rails/command.rb:93:in `sorted_groups'
/home/paulbreugnot/.rvm/gems/jruby-9.2.5.0/gems/railties-5.2.2/lib/rails/command.rb:86:in `print_commands'
/home/paulbreugnot/.rvm/gems/jruby-9.2.5.0/gems/railties-5.2.2/lib/rails/commands/help/help_command.rb:11:in `help'
/home/paulbreugnot/.rvm/gems/jruby-9.2.5.0/gems/thor-0.20.3/lib/thor/command.rb:27:in `run'
/home/paulbreugnot/.rvm/gems/jruby-9.2.5.0/gems/thor-0.20.3/lib/thor/invocation.rb:126:in `invoke_command'
/home/paulbreugnot/.rvm/gems/jruby-9.2.5.0/gems/thor-0.20.3/lib/thor.rb:387:in `dispatch'
/home/paulbreugnot/.rvm/gems/jruby-9.2.5.0/gems/railties-5.2.2/lib/rails/command/base.rb:65:in `perform'
/home/paulbreugnot/.rvm/gems/jruby-9.2.5.0/gems/railties-5.2.2/lib/rails/command.rb:46:in `<main>'
bin/rails:4:in `require'
bin/rails:4:in `<main>'
warning: thread "Ruby-0-Thread-4: /home/paulbreugnot/.rvm/gems/jruby-9.2.5.0/gems/listen-3.1.5/lib/listen/internals/thread_pool.rb:6" terminated with exception (report_on_exception is true):
IOError: closed stream
       select at org/jruby/RubyIO.java:3549
       select at org/jruby/RubyKernel.java:665
  readpartial at /home/paulbreugnot/.rvm/gems/jruby-9.2.5.0/gems/rb-inotify-0.10.0/lib/rb-inotify/notifier.rb:306
  read_events at /home/paulbreugnot/.rvm/gems/jruby-9.2.5.0/gems/rb-inotify-0.10.0/lib/rb-inotify/notifier.rb:279
      process at /home/paulbreugnot/.rvm/gems/jruby-9.2.5.0/gems/rb-inotify-0.10.0/lib/rb-inotify/notifier.rb:252
          run at /home/paulbreugnot/.rvm/gems/jruby-9.2.5.0/gems/rb-inotify-0.10.0/lib/rb-inotify/notifier.rb:229
  synchronize at org/jruby/ext/thread/Mutex.java:159
          run at /home/paulbreugnot/.rvm/gems/jruby-9.2.5.0/gems/rb-inotify-0.10.0/lib/rb-inotify/notifier.rb:226
         _run at /home/paulbreugnot/.rvm/gems/jruby-9.2.5.0/gems/listen-3.1.5/lib/listen/adapter/linux.rb:39
        start at /home/paulbreugnot/.rvm/gems/jruby-9.2.5.0/gems/listen-3.1.5/lib/listen/adapter/base.rb:78
          add at /home/paulbreugnot/.rvm/gems/jruby-9.2.5.0/gems/listen-3.1.5/lib/listen/internals/thread_pool.rb:6
org.jruby.exceptions.IOError: (IOError) closed stream
	at org.jruby.RubyIO.select(org/jruby/RubyIO.java:3549)
	at org.jruby.RubyKernel.select(org/jruby/RubyKernel.java:665)
	at RUBY.readpartial(/home/paulbreugnot/.rvm/gems/jruby-9.2.5.0/gems/rb-inotify-0.10.0/lib/rb-inotify/notifier.rb:306)
	at RUBY.read_events(/home/paulbreugnot/.rvm/gems/jruby-9.2.5.0/gems/rb-inotify-0.10.0/lib/rb-inotify/notifier.rb:279)
	at RUBY.process(/home/paulbreugnot/.rvm/gems/jruby-9.2.5.0/gems/rb-inotify-0.10.0/lib/rb-inotify/notifier.rb:252)
	at RUBY.run(/home/paulbreugnot/.rvm/gems/jruby-9.2.5.0/gems/rb-inotify-0.10.0/lib/rb-inotify/notifier.rb:229)
	at org.jruby.ext.thread.Mutex.synchronize(org/jruby/ext/thread/Mutex.java:159)
	at RUBY.run(/home/paulbreugnot/.rvm/gems/jruby-9.2.5.0/gems/rb-inotify-0.10.0/lib/rb-inotify/notifier.rb:226)
	at RUBY._run(/home/paulbreugnot/.rvm/gems/jruby-9.2.5.0/gems/listen-3.1.5/lib/listen/adapter/linux.rb:39)
	at RUBY.start(/home/paulbreugnot/.rvm/gems/jruby-9.2.5.0/gems/listen-3.1.5/lib/listen/adapter/base.rb:78)
	at RUBY.add(/home/paulbreugnot/.rvm/gems/jruby-9.2.5.0/gems/listen-3.1.5/lib/listen/internals/thread_pool.rb:6)
E, [2018-02-12T14:41:26.067101 #28080] ERROR -- : run() in thread failed: inotify event queue has overflowed.:\n /home/alex/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/rb-inotify-0.9.10/lib/rb-inotify/event.rb:120:in `initialize'
/home/alex/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/rb-inotify-0.9.10/lib/rb-inotify/event.rb:100:in `new'
/home/alex/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/rb-inotify-0.9.10/lib/rb-inotify/event.rb:100:in `consume'
/home/alex/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/rb-inotify-0.9.10/lib/rb-inotify/notifier.rb:291:in `read_events'
/home/alex/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/rb-inotify-0.9.10/lib/rb-inotify/notifier.rb:242:in `process'
/home/alex/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/rb-inotify-0.9.10/lib/rb-inotify/notifier.rb:225:in `run'
/home/alex/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/listen-3.1.5/lib/listen/adapter/linux.rb:39:in `_run'
/home/alex/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/listen-3.1.5/lib/listen/adapter/base.rb:78:in `block in start'
/home/alex/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/listen-3.1.5/lib/listen/internals/thread_pool.rb:6:in `block in add'\n\ncalled from:\n /home/alex/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/listen-3.1.5/lib/listen/listener.rb:68:in `block in <class:Listener>'
/home/alex/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/listen-3.1.5/lib/listen/fsm.rb:121:in `instance_eval'
/home/alex/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/listen-3.1.5/lib/listen/fsm.rb:121:in `call'
/home/alex/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/listen-3.1.5/lib/listen/fsm.rb:91:in `transition_with_callbacks!'
/home/alex/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/listen-3.1.5/lib/listen/fsm.rb:57:in `transition'
/home/alex/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/listen-3.1.5/lib/listen/listener.rb:91:in `start'
/home/alex/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/guard-2.14.2/lib/guard/commander.rb:35:in `start'
/home/alex/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/guard-2.14.2/lib/guard/cli/environments/valid.rb:16:in `start_guard'
/home/alex/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/guard-2.14.2/lib/guard/cli.rb:122:in `start'
/home/alex/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/thor-0.20.0/lib/thor/command.rb:27:in `run'
/home/alex/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/thor-0.20.0/lib/thor/invocation.rb:126:in `invoke_command'
/home/alex/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/thor-0.20.0/lib/thor.rb:387:in `dispatch'
/home/alex/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/thor-0.20.0/lib/thor/base.rb:466:in `start'
/home/alex/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/guard-2.14.2/lib/guard/aruba_adapter.rb:32:in `execute'
/home/alex/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/guard-2.14.2/lib/guard/aruba_adapter.rb:19:in `execute!'
/home/alex/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/guard-2.14.2/bin/_guard-core:11:in `<main>'

😕

Same here, this works for me: https://github.com/guard/listen/wiki/Increasing-the-amount-of-inotify-watchers

echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p

has anybody a solution/workaround?

yep, still an issue with docker

i’ve updated all the versions to the latest, node, npm, nvm, ruby 2.5.0, yarn 1.51 and so on… yet the same issue. it’s driving me crazy 😕

This has been merged and fixed.