$listeners = []
$tempdirs = []
1.upto(5).do
$tempdirs << Dir.mktmpdir
$listeners << Listen.to($tempdirs.last) do
# does not matter
end
end
I run my rspec suite and want to stop everything
$listeners.each(&:stop)
$tempdirs.each { |f| FileUtils.rmdir f }
However, from time to time (under heavy load almost every time) I get
E, [2018-09-11T13:55:34.462726 #26239] ERROR -- : exception while processing events: No such file or directory @ realpath_rec - /tmp/d20180911-26239-11dhxny Backtrace:
-- /home/user/showmax/gem/XXX/lib/XXX/rack/health.rb:22:in `realdirpath'
-- /home/user/showmax/gem/XXX/lib/XXX/rack/health.rb:22:in `realdirpath'
-- /home/user/showmax/gem/XXX/lib/XXX/rack/health.rb:22:in `block in initialize'
-- /home/user/.rvm/gems/ruby-2.4.4@XXX/gems/listen-3.1.5/lib/listen/event/config.rb:23:in `call'
-- /home/user/.rvm/gems/ruby-2.4.4@XXX/gems/listen-3.1.5/lib/listen/event/processor.rb:115:in `_process_changes'
-- /home/user/.rvm/gems/ruby-2.4.4@XXX/gems/listen-3.1.5/lib/listen/event/processor.rb:19:in `block in loop_for'
-- /home/user/.rvm/gems/ruby-2.4.4@XXX/gems/listen-3.1.5/lib/listen/event/processor.rb:15:in `loop'
-- /home/user/.rvm/gems/ruby-2.4.4@XXX/gems/listen-3.1.5/lib/listen/event/processor.rb:15:in `loop_for'
-- /home/user/.rvm/gems/ruby-2.4.4@XXX/gems/listen-3.1.5/lib/listen/event/loop.rb:84:in `_wait_for_changes'
-- /home/user/.rvm/gems/ruby-2.4.4@XXX/gems/listen-3.1.5/lib/listen/event/loop.rb:42:in `block in setup'
-- /home/user/.rvm/gems/ruby-2.4.4@XXX/gems/listen-3.1.5/lib/listen/internals/thread_pool.rb:6:in `block in add'
When I add some logging into the code
$listeners = []
$tempdirs = []
1.upto(5).do
$tempdirs << Dir.mktmpdir
STDERR.puts "CREATED: #{$tempdirs.last}"
$listeners << Listen.to($tempdirs.last) do
# does not matter
end
end
...
$listeners.each(&:stop)
STDERR.puts "STOPPED"
$tempdirs.each { |f| FileUtils.rmdir f }
I see this order in console:
CREATED ...
CREATED ...
...
STOPPED
E, [2018-09-11T13:55:34.462726 #26239] ERROR -- : exception while processing events: No such file or directory @ realpath_rec - /tmp/d20180911-26239-11dhxny Backtrace:
...
So the watching seems to continue even after #stop call :/
I create bunch of listeners on temp folders:
I run my rspec suite and want to stop everything
However, from time to time (under heavy load almost every time) I get
When I add some logging into the code
I see this order in console:
So the watching seems to continue even after
#stop
call :/