diff --git a/lib/fluent/plugin/in_tail.rb b/lib/fluent/plugin/in_tail.rb index fb29dd249f..6c1d236df6 100644 --- a/lib/fluent/plugin/in_tail.rb +++ b/lib/fluent/plugin/in_tail.rb @@ -523,6 +523,11 @@ def update_watcher(target_info, pe) # so adding close_io argument to avoid this problem. # At shutdown, IOHandler's io will be released automatically after detached the event loop def detach_watcher(tw, ino, close_io = true) + if @follow_inodes && tw.ino != ino + log.warn("Skip detach_watcher because this is not the expected watcher to be detached", + path: tw.path, current_ino: tw.ino, expect_ino_to_close: ino) + return + end tw.watchers.each do |watcher| event_loop_detach(watcher) end