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

Backport (v1.16): in_tail: Manage tail watchers that are rorate_wait state too (#4334) #4427

Merged
merged 1 commit into from
Mar 11, 2024

Conversation

daipom
Copy link
Contributor

@daipom daipom commented Mar 8, 2024

After a tail watcher transitions to `rotate_wait` state, the
`rotate_wait` timer is no longer managed by in_tail, it might cause
unexpected behaviour. e.g.)

* It's never unwatched when shutdown occurs before `rotate_wait` passed.
* Needless `rotate_wait` timers are executed when it detects more
  rotations.

This patch fixes such unexpected behaviour.

Note: The comment about `detach_watcher` was added in 76f246a.
At that time, closing was done by event-loop.
Now, the situation is completely different, so it should be removed.

---------

Signed-off-by: Takuro Ashie <[email protected]>
Co-authored-by: Daijiro Fukuda <[email protected]>
@ashie
Copy link
Member

ashie commented Mar 8, 2024

Hmm, it would be better to disable CI on Ruby head (by another PR) since it's never succeeded anymore.

@daipom
Copy link
Contributor Author

daipom commented Mar 8, 2024

Oh, this is not included in v1.16 branch!

We should backport this, right?

@ashie
Copy link
Member

ashie commented Mar 11, 2024

Oh, this is not included in v1.16 branch!

* [WIP: Refine CI #4380](https://github.com/fluent/fluentd/pull/4380)

We should backport this, right?

Yup

@ashie
Copy link
Member

ashie commented Mar 11, 2024

https://github.com/fluent/fluentd/actions/runs/8201645424/job/22430795800?pr=4427

Failure: test_unwatched_files_should_be_removed(TailInputTest::path)
/Users/runner/work/fluentd/fluentd/test/plugin/test_in_tail.rb:1616:in `test_unwatched_files_should_be_removed'
     1613:       waiting(20) { sleep 0.1 until Dir.glob("#{@tmp_dir}/*.txt").size == 0 } # Ensure file is deleted on Windows
     1614:       waiting(5) { sleep 0.1 until d.instance.instance_variable_get(:@tails).keys.size <= 0 }
     1615: 
  => 1616:       assert_equal(
     1617:         {
     1618:           files: [],
     1619:           tails: []
<{:files=>[], :tails=>[]}> expected but was
<{:files=>[],
 :tails=>
  ["/Users/runner/work/fluentd/fluentd/test/plugin/../tmp/tail/66f4dcae3574f5b5df9d/tail.txt"]}>

diff:
? {:files=>[], :tails=>[]}
+  :tails=>
+   ["/Users/runner/work/fluentd/fluentd/test/plugin/../tmp/tail/66f4dcae3574f5b5df9d/tail.txt"]}

It seems that sometimes it occurs only on macOS.
It's not concerned with this PR.
e.g.) https://github.com/fluent/fluentd/actions/runs/8166136702/job/22324397018
We need to investigate it later.

@ashie ashie merged commit 0d2cd95 into v1.16 Mar 11, 2024
12 of 16 checks passed
@ashie ashie deleted the v1.16-backport-4334 branch March 11, 2024 00:28
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.

2 participants