Skip to content

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

Merged
ashie merged 1 commit into
v1.16from
v1.16-backport-4334
Mar 11, 2024
Merged

Backport (v1.16): in_tail: Manage tail watchers that are rorate_wait state too (#4334)#4427
ashie merged 1 commit into
v1.16from
v1.16-backport-4334

Conversation

@daipom

@daipom daipom commented Mar 8, 2024

Copy link
Copy Markdown
Contributor

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 <ashie@clear-code.com>
Co-authored-by: Daijiro Fukuda <fukuda@clear-code.com>
@ashie

ashie commented Mar 8, 2024

Copy link
Copy Markdown
Member

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

@daipom

daipom commented Mar 8, 2024

Copy link
Copy Markdown
Contributor Author

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

We should backport this, right?

@ashie

ashie commented Mar 11, 2024

Copy link
Copy Markdown
Member

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

ashie commented Mar 11, 2024

Copy link
Copy Markdown
Member

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
@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