-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
in_tail: Manage tail watchers that are rorate_wait
state too
#4334
Conversation
0840433
to
99af9a0
Compare
Although they are unexpected behaviour, probably not harmful. |
99af9a0
to
49e5420
Compare
BTW I'm suspecting that some unstable in_tail tests are caused by it. |
13b91bd
to
94e867b
Compare
This PR has been automatically marked as stale because it has been open 30 days with no activity. Remove stale label or comment or this PR will be closed in 7 days |
Sometimes we get an error regarding unmanaged rotated tail watchers on shutdown: e.g.)
We should merge this fix to v1.16. |
rorate_wait
staterorate_wait
state too
94e867b
to
9663478
Compare
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. Signed-off-by: Takuro Ashie <[email protected]>
9663478
to
ab81c16
Compare
Thanks for this fix!
At this point, this fix basically looks good to me.
I think this occurs with When a very fast rotation occurs, a TailWatcher in the state of Without fluentd/lib/fluent/plugin/in_tail.rb Lines 545 to 553 in 175d866
It is because However, with This fix will prevent duplicate timer execution for detaching. |
Hmm, I may be wrong about this. fluentd/lib/fluent/plugin/in_tail.rb Lines 558 to 561 in 175d866
|
Signed-off-by: Daijiro Fukuda <[email protected]>
I have added tests for fast rotation. |
@ashie Can I add a commit about the points I am commenting on? |
Of course. |
Logic inside `detach_watcher()` should be independent of `rotate_wait`. Signed-off-by: Daijiro Fukuda <[email protected]>
Done. The new tests on macOS seem to be unstable. I will check them. |
The new tests are unstable on Windows or macOS. |
I'm sorry for the interval. |
I will merge this if it is confirmed that the newly added tests are stable. |
The new tests are now stable. |
I am concerned about the possibility of the key being deleted before the key is added. |
8b15478
to
f1f7866
Compare
The callbacks of timers are not called after the Note: The callbacks of timers are not called after fluentd/lib/fluent/plugin_helper/timer.rb Lines 36 to 38 in c56f91e
fluentd/lib/fluent/plugin_helper/timer.rb Lines 58 to 61 in c56f91e
fluentd/lib/fluent/plugin_helper/timer.rb Line 80 in c56f91e
|
Signed-off-by: Daijiro Fukuda <[email protected]>
The comments was added in 76f246a. At that time, closing was done by event-loop. Now, the situation is completely different. Currently, there are comments about the `close_io` option in `shutdown()` and `close()`. So, it would be enough to remove these comments. Signed-off-by: Daijiro Fukuda <[email protected]>
`sleep 1s` is too short for `enable_stat_watcher false`. Signed-off-by: Daijiro Fukuda <[email protected]>
f1f7866
to
d28f32e
Compare
The code for conflicts with timer execution is unnecessary, so I have removed them. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
(It seems that I can't change the status of this pull request, because it's originally mine 🤪)
Thanks! I will merge this soon! |
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]>
Backport (v1.16): in_tail: Manage tail watchers that are `rorate_wait` state too (#4334)
Which issue(s) this PR fixes:
N/A (Follow up for #4327 (comment))
What this PR does / why we need it:
After a tail watcher transitions to
rotate_wait
state, therotate_wait
timer is no longer managed by in_tail, it might cause unexpected behaviour. e.g.)rotate_wait
passed.rotate_wait
timers are executed when it detects more rotations.This patch fixes such unexpected behaviour.
Docs Changes:
N/A
Release Note:
in_tail: Fix tail watchers in
rotate_wait
state not being managed.