Skip to content

in_tail: fix log duplication when a rotated file is appended during rotate_wait with follow_inodes - #5499

Draft
Watson1978 wants to merge 1 commit into
fluent:masterfrom
Watson1978:in_tail-skip-rotating-inode-on-refresh
Draft

Watson1978 wants to merge 1 commit into
fluent:masterfrom
Watson1978:in_tail-skip-rotating-inode-on-refresh

Conversation

@Watson1978

@Watson1978 Watson1978 commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

Which issue(s) this PR fixes:
Fixes #4243

What this PR does / why we need it:

With follow_inodes true, a TailWatcher detached on rotation keeps reading its inode until rotate_wait elapses, but refresh_watchers only looks at @tails, so it started a second TailWatcher for the same inode and lines appended to the rotated file in that window were collected twice. This PR makes refresh_watchers skip inodes still read by a watcher waiting for rotate_wait, and the rotated file is followed again from the recorded position on the next refresh after that watcher is closed. This changes the timing of following a rotated file, so it targets the next minor release and should not be backported to v1.19.4.

Docs Changes:
N/A

Release Note:
in_tail: fix log duplication when a rotated file is appended during rotate_wait with follow_inodes

…otate_wait with follow_inodes

With follow_inodes, a TailWatcher detached on rotation keeps reading its
inode until rotate_wait elapses, but refresh_watchers only looked at
@Tails and started a second TailWatcher for the same inode. Skip inodes
still read by a watcher waiting for rotate_wait, and do not register a
watcher in @tails_rotate_wait when open_on_every_update already detached
it immediately.

Fixes fluent#4243

Signed-off-by: Shizuo Fujita <fujita@clear-code.com>
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

Successfully merging this pull request may close these issues.

in_tail: possibly collects duplicated logs in rotate_wait

1 participant