test_in_tail: fix flaky throttling test by allowing one extra watcher tick - #5489
Merged
kenhys merged 1 commit intoSep 7, 2026
Merged
Conversation
… tick
The `test "lines collected with throttling"` still fails intermittently
on CI, this time on the upper bound:
elapsed_seconds 3.329012749999947 is out of allowed range:
lower: 0.6799999999999999 [sec]
upper: 3.3200000000000003 [sec].
The throttling state is re-checked only when the tail watcher is
notified. Once the file has been fully written, retries depend mainly on
the 1s timer tick. Whether the tick that lands exactly rate_period after
the previous read start already satisfies `time_spent >= rate_period`
depends on sub-millisecond scheduling differences, so the next read can
start one tick later, i.e. rate_period + 1s after the previous one.
The existing jitter (1.32s) already contains one watcher interval, but
that allowance is shared with the read/observation latency: when the
extra tick and a slow batch coincide, only 0.32s is left for the
read-time skew and the 0.1s polling of the test thread, which is not
enough on a slow runner.
Add the watcher interval to the upper bound explicitly, so the upper
bound tolerates the same read/observation latency as the lower bound on
top of the extra tick. The per-cycle line-count assertion is kept, so a
regression that actually breaks throttling is still detected.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Signed-off-by: Shizuo Fujita <fujita@clear-code.com>
kenhys
approved these changes
Sep 7, 2026
Watson1978
added a commit
that referenced
this pull request
Sep 14, 2026
…one extra watcher tick (#5489) (#5495) **Which issue(s) this PR fixes**: Backport #5489 Fixes # **What this PR does / why we need it**: The `lines collected with throttling` test still fails intermittently after #5381 and #5418, this time on the upper bound: [Ruby 3.3 on macOS CI](https://github.com/fluent/fluentd/actions/runs/34003950778/job/101426224818) measured 3.329s against a 3.32s limit. ``` 4) Failure: test: lines collected with throttling(TailInputTest::throttling logs at in_tail level): elapsed_seconds 3.329012749999947 is out of allowed range: lower: 0.6799999999999999 [sec] upper: 3.3200000000000003 [sec]. ``` Once the file has been written, retries depend mainly on the 1s watcher timer. A tick near the 2s rate-period boundary can arrive slightly too early, delaying the next read until the following tick. Local tracing confirmed read-start intervals of both approximately 2s and 3s. The existing 1.32s allowance covers both timer scheduling and read/observation latency. When an extra tick consumes 1s, only 0.32s remains for other delays—slightly less than this CI run needed. This PR adds one watcher interval to the upper bound, increasing it from 3.32s to 4.32s. The lower bound and record-count assertions remain unchanged. **Docs Changes**: N/A **Release Note**: N/A Signed-off-by: Shizuo Fujita <fujita@clear-code.com> Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Shizuo Fujita <fujita@clear-code.com> Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Which issue(s) this PR fixes:
Fixes #
What this PR does / why we need it:
The
lines collected with throttlingtest still fails intermittently after #5381 and #5418, this time on the upper bound: Ruby 3.3 on macOS CI measured 3.329s against a 3.32s limit.Once the file has been written, retries depend mainly on the 1s watcher timer. A tick near the 2s rate-period boundary can arrive slightly too early, delaying the next read until the following tick. Local tracing confirmed read-start intervals of both approximately 2s and 3s.
The existing 1.32s allowance covers both timer scheduling and read/observation latency. When an extra tick consumes 1s, only 0.32s remains for other delays—slightly less than this CI run needed.
This PR adds one watcher interval to the upper bound, increasing it from 3.32s to 4.32s. The lower bound and record-count assertions remain unchanged.
Docs Changes:
N/A
Release Note:
N/A